XSTL Processing Pipeline has been created by Felix Meschberger (Apr 03, 2009).

Content:

In the Apache Sling Scripting W3C XML Processing Support bundle, Juan Jo Vazquez has implemented XLST processing support for Sling as another new scripting engine.

Simple

This is the first very simple sample which Bertrand Delacretaz has posted to Sling developers list. More samples and completion to come.

1. Install the org.apache.sling.scripting.xproc bundle by either building it from contrib/scripting/xproc folder in the Sling trunk or by dowloading it from the Apache Snapshot repository here: org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar

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="" class="code-quote">"/apps/xproc/one.xsl"/>
    </p:input>
  </p:xslt>

  <p:xslt>
    <p:input port="stylesheet">
      <p:document href="" class="code-quote">"/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