You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by jv...@apache.org on 2009/02/18 20:59:52 UTC

svn commit: r745630 - in /incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc: ./ src/main/java/org/apache/sling/cocoon/ src/main/java/org/apache/sling/scripting/xproc/ src/main/java/org/apache/sling/xproc/api/ src/main/java/org/apache...

Author: jvazquez
Date: Wed Feb 18 19:59:50 2009
New Revision: 745630

URL: http://svn.apache.org/viewvc?rev=745630&view=rev
Log:
prototype improved

Added:
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/data/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/data/xml.esp
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/html.xpl
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/test.xml
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-content.xslt
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-html.xslt
Modified:
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Input.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Pipeline.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/XplElement.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Xslt.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/AbstractXplElement.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/DocumentImpl.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/InputImpl.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/PipelineImpl.java
    incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/XsltImpl.java

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml Wed Feb 18 19:59:50 2009
@@ -56,22 +56,11 @@
                     <instructions>
                         <Private-Package>
                             org.apache.sling.scripting.xproc.*,
-                            org.apache.sling.xproc.*
+                            org.apache.sling.xproc.*,
+                            org.apache.sling.cocoon.*
                         </Private-Package>
-
                         <Embed-Dependency>cocoon-pipeline;inline=true</Embed-Dependency>
-                        <!--  
-                        <Import-Package>
-                            javax.servlet.jsp.*; javax.swing.*;
-                            org.apache.log; org.apache.log4j;
-                            org.apache.tools.ant.*;
-                            org.apache.xml.utils; org.apache.xpath.*;
-                            org.dom4j.*; org.jaxen.*; org.jdom.*;
-                            org.mozilla.javascript;
-                            org.python.*;resolution:=optional, *
-                        </Import-Package>
-                        -->
-                        
+                        <Sling-Initial-Content>SLING-INF/content;uninstall:=true</Sling-Initial-Content>
                         <ScriptEngine-Name>${pom.name}</ScriptEngine-Name>
                         <ScriptEngine-Version>${pom.version}</ScriptEngine-Version>
                     </instructions>

Added: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java?rev=745630&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java (added)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java Wed Feb 18 19:59:50 2009
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.cocoon;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.servlet.RequestDispatcher;
+
+import org.apache.cocoon.pipeline.component.sax.AbstractGenerator;
+import org.apache.cocoon.pipeline.util.XMLUtils;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.request.RequestDispatcherOptions;
+import org.apache.sling.api.resource.Resource;
+
+public class SlingGenerator extends AbstractGenerator {
+	
+	private SlingHttpServletRequest request;
+	private SlingHttpServletResponse response;
+	
+	public SlingGenerator(SlingHttpServletRequest request, SlingHttpServletResponse response) {
+		this.request = request;
+		this.response = response;
+	}
+	
+	public void execute() {
+		try {
+			XMLUtils.toSax(genXml(), this.getXMLConsumer());
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	private InputStream genXml() throws Exception {
+		return null;
+//		Resource resource = request.getResource();
+//		RequestDispatcherOptions options = new RequestDispatcherOptions();
+//		options.setForceResourceType("sling/xpl/sample/data");
+//		RequestDispatcher dispatcher = request.getRequestDispatcher(resource, options);
+//		dispatcher.include(request, response);
+////		resource = request.getResourceResolver().resolve(resource.getPath() + ".xml");
+//		resource = request.getResourceResolver().resolve("/xpl-sample/pipelines/test_pipeline.xml");
+//		URL source = resource.adaptTo(URL.class);
+//		return source.openConnection().getInputStream();
+	}
+
+}

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java Wed Feb 18 19:59:50 2009
@@ -27,6 +27,7 @@
 
 import org.apache.sling.api.scripting.SlingBindings;
 import org.apache.sling.api.scripting.SlingScriptHelper;
+import org.apache.sling.cocoon.SlingGenerator;
 import org.apache.sling.scripting.api.AbstractSlingScriptEngine;
 import org.apache.sling.xproc.XplBuilder;
 import org.apache.sling.xproc.api.Pipeline;
@@ -53,6 +54,8 @@
 		try {
 			XplBuilder xplBuilder = new XplBuilder();
 			Pipeline xpl = (Pipeline) xplBuilder.build(reader);
+			SlingGenerator generator = new SlingGenerator(helper.getRequest(), helper.getResponse());
+			xpl.setGenerator(generator);
 			xpl.execute(helper.getResponse().getOutputStream());
 		} catch (Throwable t) {
 			log.error("Failure running XProc script.", t);

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Input.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Input.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Input.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Input.java Wed Feb 18 19:59:50 2009
@@ -19,5 +19,13 @@
 package org.apache.sling.xproc.api;
 
 public interface Input extends XplElement {
+	
+	String getPort();
 
+	void setPort(String port);
+	
+	Document getDocument();
+
+	void setDocument(Document document);
+	
 }

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Pipeline.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Pipeline.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Pipeline.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Pipeline.java Wed Feb 18 19:59:50 2009
@@ -20,8 +20,12 @@
 
 import java.io.OutputStream;
 
+import org.apache.cocoon.pipeline.component.sax.AbstractGenerator;
+
 public interface Pipeline extends CompoundStep {
 	
 	void execute(OutputStream outputStream) throws Exception;
 	
+	void setGenerator(AbstractGenerator generator);
+	
 }

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/XplElement.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/XplElement.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/XplElement.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/XplElement.java Wed Feb 18 19:59:50 2009
@@ -18,6 +18,7 @@
  */
 package org.apache.sling.xproc.api;
 
+import java.util.LinkedList;
 import java.util.Map;
 
 public interface XplElement {
@@ -28,6 +29,8 @@
 	
 	void setParent(XplElement parent);
 	
+	LinkedList<XplElement> getChildren();
+	
 	void addChild(XplElement child);
 	
 	void invoke(Invocation invocation) throws Exception;

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Xslt.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Xslt.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Xslt.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/api/Xslt.java Wed Feb 18 19:59:50 2009
@@ -20,4 +20,8 @@
 
 public interface Xslt extends AtomicStep {
 	
+	Input getStylesheet();
+
+	void setStylesheet(Input stylesheet);
+	
 }

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/AbstractXplElement.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/AbstractXplElement.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/AbstractXplElement.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/AbstractXplElement.java Wed Feb 18 19:59:50 2009
@@ -41,9 +41,34 @@
 	
 	private final LinkedList<XplElement> children = new LinkedList<XplElement>();
 	
+	public LinkedList<XplElement> getChildren() {
+		return children;
+	}
+
 	public void addChild(XplElement child) {
-		this.children.add(child);
+		
+		if (child == null) {
+            String msg = "Element of class " + this.getClass().getName() + " received null child.";
+            this.log.error(msg);
+            throw new IllegalArgumentException(msg);
+        }
+		
+		Field childField = this.getChildField(child);
+        if (childField != null) {
+            childField.setAccessible(true);
+            try {
+                childField.set(this, child);
+            } catch (IllegalArgumentException e) {
+                this.log.error("Failed to set child field for child class '" + child.getClass().getName(), e);
+            } catch (IllegalAccessException e) {
+                this.log.error("Failed to set child field for child class '" + child.getClass().getName(), e);
+            }
+        } else {
+            this.children.add(child);
+        }
+		
 		child.setParent(this);
+		
 	}
 	
 	public void invoke(Invocation invocation) throws Exception {
@@ -97,7 +122,20 @@
 	protected void processParameter(String key, String value) {
         this.parameters.put(key, value);
     }
+	
+	private Field getChildField(XplElement child) {
+        Class<?> currentClass = this.getClass();
+
+        Field[] declaredFields = currentClass.getDeclaredFields();
+        for (Field declaredField : declaredFields) {
+            if (declaredField.getType().isAssignableFrom(child.getClass())) {
+                return declaredField;
+            }
+        }
 
+        return null;
+    }
+	
     private Map<String, Field> getParameterFields() {
         Map<String, Field> parameterFields = new HashMap<String, Field>();
 

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/DocumentImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/DocumentImpl.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/DocumentImpl.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/DocumentImpl.java Wed Feb 18 19:59:50 2009
@@ -18,22 +18,12 @@
  */
 package org.apache.sling.xproc.impl;
 
-import java.net.URL;
-
-import org.apache.cocoon.pipeline.component.sax.XSLTTransformer;
 import org.apache.sling.xproc.api.Document;
-import org.apache.sling.xproc.api.Invocation;
 
 public class DocumentImpl extends AbstractXplElement implements Document {
 
 	private String href;
 	
-	@Override
-	public void invoke(Invocation invocation) throws Exception {
-		invocation.getCocoonPipeline().addComponent(new XSLTTransformer(new URL(href)));
-		super.invoke(invocation);
-	}
-	
 	public String getHref() {
 		return href;
 	}

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/InputImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/InputImpl.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/InputImpl.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/InputImpl.java Wed Feb 18 19:59:50 2009
@@ -18,9 +18,28 @@
  */
 package org.apache.sling.xproc.impl;
 
+import org.apache.sling.xproc.api.Document;
 import org.apache.sling.xproc.api.Input;
 
 public class InputImpl extends AbstractXplElement implements Input {
 
+	private String port;
+	private Document document;
 
+	public String getPort() {
+		return port;
+	}
+
+	public void setPort(String port) {
+		this.port = port;
+	}
+	
+	public Document getDocument() {
+		return document;
+	}
+
+	public void setDocument(Document document) {
+		this.document = document;
+	}
+	
 }

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/PipelineImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/PipelineImpl.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/PipelineImpl.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/PipelineImpl.java Wed Feb 18 19:59:50 2009
@@ -19,20 +19,25 @@
 package org.apache.sling.xproc.impl;
 
 import java.io.OutputStream;
-import java.net.URL;
 
 import org.apache.cocoon.pipeline.NonCachingPipeline;
-import org.apache.cocoon.pipeline.component.sax.FileGenerator;
+import org.apache.cocoon.pipeline.component.sax.AbstractGenerator;
 import org.apache.cocoon.pipeline.component.sax.XMLSerializer;
 import org.apache.sling.xproc.api.Invocation;
 import org.apache.sling.xproc.api.Pipeline;
 
 public class PipelineImpl extends AbstractXplElement implements Pipeline {
 	
+	private AbstractGenerator generator;
+
 	public void execute(OutputStream outputStream) throws Exception {
+		
+		if (generator == null)
+			throw new IllegalStateException("xml generator is missing.");
+		
 		org.apache.cocoon.pipeline.Pipeline cocoonPipeline = new NonCachingPipeline();
 		
-		cocoonPipeline.addComponent(new FileGenerator(new URL("http://localhost:8888/pipeline-sample/generator/test.xml")));
+		cocoonPipeline.addComponent(generator);
 		
 		Invocation invocation = new InvocationImpl();
 		invocation.setCocoonPipeline(cocoonPipeline);
@@ -42,5 +47,9 @@
 		cocoonPipeline.setup(outputStream);
 		cocoonPipeline.execute();
 	}
+	
+	public void setGenerator(AbstractGenerator generator) {
+		this.generator = generator;
+	}
 
 }

Modified: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/XsltImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/XsltImpl.java?rev=745630&r1=745629&r2=745630&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/XsltImpl.java (original)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/xproc/impl/XsltImpl.java Wed Feb 18 19:59:50 2009
@@ -18,8 +18,30 @@
  */
 package org.apache.sling.xproc.impl;
 
+import java.net.URL;
+
+import org.apache.cocoon.pipeline.component.sax.XSLTTransformer;
+import org.apache.sling.xproc.api.Input;
+import org.apache.sling.xproc.api.Invocation;
 import org.apache.sling.xproc.api.Xslt;
 
 public class XsltImpl extends AbstractXplElement implements Xslt {
+	
+	private Input stylesheet;
+
+	@Override
+	public void invoke(Invocation invocation) throws Exception {
+		super.invoke(invocation);
+		String href = this.getStylesheet().getDocument().getHref();
+		invocation.getCocoonPipeline().addComponent(new XSLTTransformer(new URL(href)));
+	}
+	
+	public Input getStylesheet() {
+		return stylesheet;
+	}
 
+	public void setStylesheet(Input stylesheet) {
+		this.stylesheet = stylesheet;
+	}
+	
 }
\ No newline at end of file

Added: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/data/xml.esp
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/data/xml.esp?rev=745630&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/data/xml.esp (added)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/data/xml.esp Wed Feb 18 19:59:50 2009
@@ -0,0 +1,2 @@
+<test/>
+

Added: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/html.xpl
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/html.xpl?rev=745630&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/html.xpl (added)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/html.xpl Wed Feb 18 19:59:50 2009
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<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>

Added: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json?rev=745630&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json (added)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json Wed Feb 18 19:59:50 2009
@@ -0,0 +1,8 @@
+{	
+	"title": "pipelines",
+	"jcr:primaryType":"nt:unstructured",
+	"test_pipeline": {
+		"title": "test_pipeline",
+		"sling:resourceType": "sling/xpl/sample"
+	}
+}
\ No newline at end of file

Added: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/test.xml
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/test.xml?rev=745630&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/test.xml (added)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/test.xml Wed Feb 18 19:59:50 2009
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<test/>
\ No newline at end of file

Added: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-content.xslt
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-content.xslt?rev=745630&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-content.xslt (added)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-content.xslt Wed Feb 18 19:59:50 2009
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:template match="/test">
+    <content>A little bit of content.</content>
+  </xsl:template>
+</xsl:stylesheet>

Added: incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-html.xslt
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-html.xslt?rev=745630&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-html.xslt (added)
+++ incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/xsl/test-html.xslt Wed Feb 18 19:59:50 2009
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:template match="/">
+    <html>
+      <head>
+        <title>Just a pretty simple pipeline.</title>
+      </head>
+      <body>
+        The pipeline contents:
+        <xsl:value-of select="/content"/>
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file