Hi,

2009/4/1 Juan José Vázquez Delgado <[email protected]>:
> 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:ad...@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:ad...@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>

Reply via email to