You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2009/04/01 17:19:52 UTC

Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Hi,

2009/4/1 Juan José Vázquez Delgado <ju...@gmail.com>:
> Bertrand said:
>> SLING-893 Pipeline support - still in the whiteboard, right? I'm going
>> to test it today.
>
> As discussed in [1], pipeline support stuff has been already saved in
> contrib [2]. I´m going to close SLING-893 and open new issues for
> enhancements....

Great, thanks!

I made minor improvements to error reporting (SLING-908), below are
some notes about how to use this - we'll need to turn this (or better
examples) into some docs later on. For now, just saving this here.
Cool stuff!

-Bertrand


Example using the xproc script engine - rough notes:

1) Install the org.apache.sling.scripting.xproc bundle (found in
contrib/scripting/xproc)

2) Create some content:
$ curl -F sling:resourceType=xproc -F title="some title" -F text="And
some text" http://admin:admin@localhost:8888/foo

3) Create a pipeline script at /apps/xproc/xproc.xpl:

<?xml version="1.0" encoding="UTF-8"?>
<p:pipeline xmlns:p="http://www.w3.org/ns/xproc">

  <p:xslt>
    <p:input port="stylesheet">
      <p:document href="/apps/xproc/one.xsl"/>
    </p:input>
  </p:xslt>

  <p:xslt>
    <p:input port="stylesheet">
      <p:document href="/apps/xproc/two.xsl"/>
    </p:input>
  </p:xslt>

</p:pipeline>

4) Store the XSLT transforms in the repository:

/apps/xproc/one.xsl:

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

<xsl:template match="/">
  <one>
    <xsl:copy-of select="."/>
  </one>
</xsl:template>

</xsl:stylesheet>


/apps/xproc/two.xsl:

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

<xsl:template match="/">
  <two>
    <xsl:copy-of select="."/>
  </two>
</xsl:template>

</xsl:stylesheet>

5) Request foo.html to execute the pipeline:

$ curl http://admin:admin@localhost:8888/foo.html

<?xml version="1.0" encoding="UTF-8"?>
<two>
  <one>
    <foo ...sling:resourceType="xproc" text="And some text" title="some title"/>
  </one>
</two>

Re: Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Posted by Juan José Vázquez Delgado <ju...@gmail.com>.
> I have created a documentation page at [1] which should shortly appear
> on our site (follow Development -> Integrating Scripting Languages ->
> XSLT ...)
>
> This page may be edited directly in the SLINGxSITE wiki to update the site.

Thanks Felix. I´ll work at it soon.

Juanjo.

Re: Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Fri, Apr 3, 2009 at 1:53 PM, Felix Meschberger <fm...@gmail.com> wrote:
> I have created a documentation page at [1] which should shortly appear
> on our site (follow Development -> Integrating Scripting Languages ->
> XSLT ...)

Thanks! Just added a note that the xproc module uses the Cocoon 3
pipeline engine.

-Bertrand

[1] http://cwiki.apache.org/confluence/display/SLINGxSITE/XSLT+Processing+Pipeline

Re: Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Bertrand Delacretaz schrieb:
> Hi,
> 
> 2009/4/1 Juan José Vázquez Delgado <ju...@gmail.com>:
>> Bertrand said:
>>> SLING-893 Pipeline support - still in the whiteboard, right? I'm going
>>> to test it today.
>> As discussed in [1], pipeline support stuff has been already saved in
>> contrib [2]. I´m going to close SLING-893 and open new issues for
>> enhancements....
> 
> Great, thanks!

+1

> I made minor improvements to error reporting (SLING-908), below are
> some notes about how to use this - we'll need to turn this (or better
> examples) into some docs later on. For now, just saving this here.
> Cool stuff!
> 
> -Bertrand
> 
> 
> Example using the xproc script engine - rough notes:

I have created a documentation page at [1] which should shortly appear
on our site (follow Development -> Integrating Scripting Languages ->
XSLT ...)

This page may be edited directly in the SLINGxSITE wiki to update the site.

Regards
Felix



Re: Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Posted by Juan José Vázquez Delgado <ju...@gmail.com>.
>> > Just wondering, if the xpl
>> > file is at /apps/xproc/xproc.xpl, what tells sling that it should resolve
>> > the .html extension in this example to the script?
>> > I would have guessed /apps/xproc/sling/servlet/default/html.xpl ..
>>
>> Because of resource type is "xproc", you have:
>>
>> /apps
>>  +-- xproc [resource type in our case]
>>          -- xproc.xpl [xpl -> script manager is XProc & xproc -> is
>> not an extesion, so relies on default, i.e. "html"]
>
>
> Of course, should have seen that, but it supports extentions and methods as
> well, right?

Sure, "html.xpl" is fine too.

Juanjo.

Re: Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Posted by Erik Buene <er...@idium.no>.
Hi

2009/4/3 Juan José Vázquez Delgado <ju...@gmail.com>

> > Just wondering, if the xpl
> > file is at /apps/xproc/xproc.xpl, what tells sling that it should resolve
> > the .html extension in this example to the script?
> > I would have guessed /apps/xproc/sling/servlet/default/html.xpl ..
>
> Because of resource type is "xproc", you have:
>
> /apps
>  +-- xproc [resource type in our case]
>          -- xproc.xpl [xpl -> script manager is XProc & xproc -> is
> not an extesion, so relies on default, i.e. "html"]


Of course, should have seen that, but it supports extentions and methods as
well, right?

Cheers,
Erik Buene

Re: Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Posted by Juan José Vázquez Delgado <ju...@gmail.com>.
Hi,

> Exciting stuff for an old xslt head like myself.

Yeap, XST is still the best option in a lot of situations.

> Just wondering, if the xpl
> file is at /apps/xproc/xproc.xpl, what tells sling that it should resolve
> the .html extension in this example to the script?
> I would have guessed /apps/xproc/sling/servlet/default/html.xpl ..

Because of resource type is "xproc", you have:

/apps
  +-- xproc [resource type in our case]
          -- xproc.xpl [xpl -> script manager is XProc & xproc -> is
not an extesion, so relies on default, i.e. "html"]

Hope this helps,

Juanjo.

Re: Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Posted by Erik Buene <er...@idium.no>.
Exciting stuff for an old xslt head like myself. Just wondering, if the xpl
file is at /apps/xproc/xproc.xpl, what tells sling that it should resolve
the .html extension in this example to the script?
I would have guessed /apps/xproc/sling/servlet/default/html.xpl ..

Regards,
Erik Buene


2009/4/1 Bertrand Delacretaz <bd...@apache.org>

> Hi,
>
> 2009/4/1 Juan José Vázquez Delgado <ju...@gmail.com>:
> > Bertrand said:
> >> SLING-893 Pipeline support - still in the whiteboard, right? I'm going
> >> to test it today.
> >
> > As discussed in [1], pipeline support stuff has been already saved in
> > contrib [2]. I´m going to close SLING-893 and open new issues for
> > enhancements....
>
> Great, thanks!
>
> I made minor improvements to error reporting (SLING-908), below are
> some notes about how to use this - we'll need to turn this (or better
> examples) into some docs later on. For now, just saving this here.
> Cool stuff!
>
> -Bertrand
>
>
> Example using the xproc script engine - rough notes:
>
> 1) Install the org.apache.sling.scripting.xproc bundle (found in
> contrib/scripting/xproc)
>
> 2) Create some content:
> $ curl -F sling:resourceType=xproc -F title="some title" -F text="And
> some text" http://admin:admin@localhost:8888/foo
>
> 3) Create a pipeline script at /apps/xproc/xproc.xpl:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <p:pipeline xmlns:p="http://www.w3.org/ns/xproc">
>
>  <p:xslt>
>    <p:input port="stylesheet">
>      <p:document href="/apps/xproc/one.xsl"/>
>    </p:input>
>  </p:xslt>
>
>  <p:xslt>
>    <p:input port="stylesheet">
>      <p:document href="/apps/xproc/two.xsl"/>
>    </p:input>
>  </p:xslt>
>
> </p:pipeline>
>
> 4) Store the XSLT transforms in the repository:
>
> /apps/xproc/one.xsl:
>
> <xsl:stylesheet version="1.0"
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
>
> <xsl:template match="/">
>  <one>
>    <xsl:copy-of select="."/>
>  </one>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> /apps/xproc/two.xsl:
>
> <xsl:stylesheet version="1.0"
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
>
> <xsl:template match="/">
>  <two>
>    <xsl:copy-of select="."/>
>  </two>
> </xsl:template>
>
> </xsl:stylesheet>
>
> 5) Request foo.html to execute the pipeline:
>
> $ curl http://admin:admin@localhost:8888/foo.html
>
> <?xml version="1.0" encoding="UTF-8"?>
> <two>
>  <one>
>    <foo ...sling:resourceType="xproc" text="And some text" title="some
> title"/>
>  </one>
> </two>
>

Re: Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Posted by Bertrand Delacretaz <bd...@apache.org>.
2009/4/1 Juan José Vázquez Delgado <ju...@gmail.com>:
> ...I hope to have samples and more improvements soon...

It would be cool to explain to the Cocoon community what you've done,
and maybe some parts could be of general interest and could move
there?

Ideally, describing what you've done on the wiki in terms of how the
Cocoon stuff is used would help.

I could do that, but you probably know better - or feel free to point
me to existing info. I've been more or less out of touch with Sling in
the last few weeks, might have missed something.

-Bertrand

Re: Cocoon pipelines in Sling, using XPL - thanks Juanjo! (was: Sling Release)

Posted by Juan José Vázquez Delgado <ju...@gmail.com>.
>>> SLING-893 Pipeline support - still in the whiteboard, right? I'm going
>>> to test it today.
>>
>> As discussed in [1], pipeline support stuff has been already saved in
>> contrib [2]. I´m going to close SLING-893 and open new issues for
>> enhancements....
>
> Great, thanks!
>
> I made minor improvements to error reporting (SLING-908), below are
> some notes about how to use this - we'll need to turn this (or better
> examples) into some docs later on. For now, just saving this here.
> Cool stuff!

wow, thnks!.

> Example using the xproc script engine - rough notes:
>.....

Cool sample. I hope to have samples and more improvements soon.

Regards,

Juanjo.