Hi guys,

Last days, i have been working on a new prototype about a certain kind
of XML pipelines support in Sling [1]. The prototype is making these
main assumptions:

1. A XML pipeline is expressed as a W3C XProc [2] file with "xpl"
extension. For instance:

<p:pipeline xmlns:p="http://www.w3.org/ns/xproc";>

  <p:xslt>
    <p:input port="stylesheet">
      <p:document
href="http://localhost:8888/xpl-sample/xsl/test-content.xslt"/>
    </p:input>
  </p:xslt>

</p:pipeline>

2. The pipeline (xpl file) is interpreted by a scripting engine named
"XProc" or  "XML pipeline processor".

3. The XProc script engine relies on Cocoon 3 Pipeline in order to
setup and execute the pipeline.

4. A Cocoon generator named SlingGenerator is responsible for
preparing the input data.

5. A Cocoon transformer named SlingXsltTransformer will be responsible
for resolving XSLT templates.


Now, my main problem is the point 4. Because of the generator needs an
InputStream with XML data, my first approach was:

/apps/sling/xpl/sample/html.xpl

/xpl-sample/pipelines/test_pipeline
                +-- sling:resourceType: "sling/xpl/sample"
                +-- sling:datasource: "/xpl-sample/test.xml"

/xpl-sample/test.xml

private InputStream genXml() throws Exception {
        Resource resource = request.getResource();
        Map props = resource.adaptTo(Map.class);
        String absPathGen = props.get("sling:datasource").toString();
        Resource genResource = 
request.getResourceResolver().resolve(absPathGen);
        return genResource.adaptTo(InputStream.class);
}

This is ok if my data source is a XML file but, what happens if we
have another reource type?. For instance, I´d like been able to
generate XML data source as a result of executing a script. I tried
this, in a similar way that "SlingRequestDispatcher include" works,
but I didn´t succeed. Any ideas?.

Thanks in advance,

BR,

Juanjo.


[1] 
https://svn.apache.org/repos/asf/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc
[2] http://www.w3.org/TR/xproc/

Reply via email to