incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1420577 [30/30] - in /sling/site/trunk/content/site: ./ 46-line-blog.data/ authentication.data/ documentation.data/ first-steps.data/ getting-and-building-sling.data/ how-to-manage-events-in-sling.data/ index.data/ links.data/ manipulating...
Date Wed, 12 Dec 2012 09:14:44 GMT
Added: sling/site/trunk/content/site/xslt-processing-pipeline.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/xslt-processing-pipeline.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/xslt-processing-pipeline.html (added)
+++ sling/site/trunk/content/site/xslt-processing-pipeline.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,258 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - XSLT Processing Pipeline</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/site.css" type="text/css"
media="all">
+    <LINK rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://sling.apache.org/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://www.apache.org/">
+          <IMG border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+<P><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR
class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR
class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp;
How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API
docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR
class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR
class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR
class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR
class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR
class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue
Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse
Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR
class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become
a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy
Stuff</A></P>
+
+
+  <IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left"
frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A
href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A
href="old-stuff.html" title="Old Stuff">Old Stuff</A>&nbsp;&gt;&nbsp;<A
href="scriptengineintegration.html" title="ScriptEngineIntegration">ScriptEngineIntegration</A>&nbsp;&gt;&nbsp;<A
href="" title="XSLT Processing Pipeline">XSLT Processing Pipeline</A>
+        </DIV>
+
+<P>In the <EM>Apache Sling Scripting W3C XML Processing Support</EM> bundle,
Juanjo V&aacute;zquez has implemented XSLT processing support for Sling as another new
scripting engine, based on the <A href="http://cocoon.apache.org/3.0/" class="external-link"
rel="nofollow">Cocoon 3 pipeline engine</A>.</P>
+
+<H2><A name="XSLTProcessingPipeline-Intro"></A>Intro</H2>
+
+<P>An XML pipeline specifies a sequence of operations to be performed on zero or more
XML documents. There are a number of advantages to using pipelines above all in terms of separation
of concerns. On the other hand, we talk about XSLT processing if the operations in a pipeline
are performed executing or applying XSLT stylesheets.</P>
+
+<P>XSLT processing support is implemented in Sling as an scripting engine bundle named
<EM>Apache Sling Scripting W3C XML Processing Support</EM>. This bundle is based
on the <A href="http://cocoon.apache.org/3.0/" class="external-link" rel="nofollow">Cocoon
3 pipeline engine</A> and uses the <A href="http://www.w3.org/TR/xproc/" class="external-link"
rel="nofollow">W3C XProc language</A> in order to specify pipelines to be processed.</P>
+
+<P>For the time being, XProc is partially implemented and it&acute;s not clear
that Sling must support all W3C recomendation yet. This could depend of concrete user requirements
or use cases.</P>
+
+<P>The source code is found in the <A href="http://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/scripting/xproc"
class="external-link" rel="nofollow">contrib/scripting/xproc</A> module.</P>
+
+<H2><A name="XSLTProcessingPipeline-HowtoInstall"></A>How to Install</H2>
+
+<P>Install the <TT>org.apache.sling.scripting.xproc</TT> bundle in order
to work with XProc. You can achieve this either building it from <TT>contrib/scripting/xproc</TT>
folder in the Sling trunk or by downloading it from the Apache Snapshot repository here: <A
href="http://people.apache.org/repo/m2-snapshot-repository/org/apache/sling/org.apache.sling.scripting.xproc/2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar"
class="external-link" rel="nofollow">org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar</A>.</P>
+
+<P>To deploy the bundle go to the bundles page of Apache Felix Web Console (<A href="http://localhost:8888/system/console/bundles"
class="external-link" rel="nofollow">http://localhost:8888/system/console/bundles</A>),
select the bundle file to upload, check the Start check box and click Install or Update button.</P>
+
+<P>In order to check whether XProc scripting engine has been installed, go to the Script
Engines page of the Apache Felix Web Console and see the entry for XProc there:</P>
+
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent
panelContent">
+<PRE>Apache Sling Scripting W3C XML Processing Support, 2.0.0-incubator-SNAPSHOT
+  	Language 	XMLProc, 1.0
+  	Extensions 	xpl
+  	MIME Types 	application/xml
+  	Names 	XProc, xml processing, xml pipeline processor 
+</PRE>
+</DIV></DIV>
+
+<H2><A name="XSLTProcessingPipeline-Howitworks"></A>How it works</H2>
+
+<P>As explained above, the bundle is able to perform a sequence of XSLT transforms
on an XML document just as is expressed in a pipeline definition. A pipeline definition is
a file with an xpl extension that follows the <A href="http://www.w3.org/TR/xproc/" class="external-link"
rel="nofollow">W3C XProc grammar</A>. Only <TT>p:xslt</TT> steps are
supported at the moment.</P>
+
+<P>For the XML input of pipeline, the processing uses a Cocoon generator named <TT>SlingGenerator</TT>
that tries to resolve the requested resource as (in order of preference):</P>
+
+<UL>
+	<LI>an static XML file</LI>
+	<LI>a dynamically generated XML</LI>
+	<LI>the underlying node&acute;s export document view</LI>
+</UL>
+
+
+<H2><A name="XSLTProcessingPipeline-Samples"></A>Samples</H2>
+
+<P>Let&acute;s see some samples in order to understand the processing behaviour.</P>
+
+<P>1. Create some content</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent
panelContent">
+<PRE>$ curl -F sling:resourceType=xproc -F title=&quot;some title&quot; -F
text=&quot;And some text&quot; http://admin:admin@localhost:8888/foo
+</PRE>
+</DIV></DIV>
+<P>2. Use WebDAV or curl to create a pipeline script at <TT>/apps/xproc/xproc.xpl</TT>
:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-xml">
+<SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>
encoding=<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>?&gt;</SPAN>
+<SPAN class="code-tag">&lt;p:pipeline <SPAN class="code-keyword">xmlns:p</SPAN>=<SPAN
class="code-quote">&quot;http://www.w3.org/ns/xproc&quot;</SPAN>&gt;</SPAN>
+
+  <SPAN class="code-tag">&lt;p:xslt&gt;</SPAN>
+    <SPAN class="code-tag">&lt;p:input port=<SPAN class="code-quote">&quot;stylesheet&quot;</SPAN>&gt;</SPAN>
+      <SPAN class="code-tag">&lt;p:document href=<SPAN class="code-quote">&quot;/apps/xproc/one.xsl&quot;</SPAN>/&gt;</SPAN>
+    <SPAN class="code-tag">&lt;/p:input&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/p:xslt&gt;</SPAN>
+
+  <SPAN class="code-tag">&lt;p:xslt&gt;</SPAN>
+    <SPAN class="code-tag">&lt;p:input port=<SPAN class="code-quote">&quot;stylesheet&quot;</SPAN>&gt;</SPAN>
+      <SPAN class="code-tag">&lt;p:document href=<SPAN class="code-quote">&quot;/apps/xproc/two.xsl&quot;</SPAN>/&gt;</SPAN>
+    <SPAN class="code-tag">&lt;/p:input&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/p:xslt&gt;</SPAN>
+
+<SPAN class="code-tag">&lt;/p:pipeline&gt;</SPAN>
+</PRE>
+</DIV></DIV>
+<P>3. Store the XSLT transforms in the repository:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><B>/apps/xproc/one.xsl</B></DIV><DIV
class="codeContent panelContent">
+<PRE class="code-xml">
+&lt;<SPAN class="code-keyword">xsl:stylesheet</SPAN> version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>
+    <SPAN class="code-keyword">xmlns:xsl</SPAN>=<SPAN class="code-quote">&quot;http://www.w3.org/1999/XSL/Transform&quot;</SPAN>&gt;
+
+<SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:template</SPAN>
match=<SPAN class="code-quote">&quot;/&quot;</SPAN>&gt;</SPAN>
+  <SPAN class="code-tag">&lt;one&gt;</SPAN>
+    <SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:copy-of</SPAN>
select=<SPAN class="code-quote">&quot;.&quot;</SPAN>/&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/one&gt;</SPAN>
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:template</SPAN>&gt;</SPAN>
+
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:stylesheet</SPAN>&gt;</SPAN>
+</PRE>
+</DIV></DIV>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><B>/apps/xproc/two.xsl</B></DIV><DIV
class="codeContent panelContent">
+<PRE class="code-xml">
+&lt;<SPAN class="code-keyword">xsl:stylesheet</SPAN> version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>
+    <SPAN class="code-keyword">xmlns:xsl</SPAN>=<SPAN class="code-quote">&quot;http://www.w3.org/1999/XSL/Transform&quot;</SPAN>&gt;
+
+<SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:template</SPAN>
match=<SPAN class="code-quote">&quot;/&quot;</SPAN>&gt;</SPAN>
+  <SPAN class="code-tag">&lt;two&gt;</SPAN>
+    <SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:copy-of</SPAN>
select=<SPAN class="code-quote">&quot;.&quot;</SPAN>/&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/two&gt;</SPAN>
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:template</SPAN>&gt;</SPAN>
+
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:stylesheet</SPAN>&gt;</SPAN>
+</PRE>
+</DIV></DIV>
+<P>4. Request foo.html to execute the pipeline:</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent
panelContent">
+<PRE>$ curl http://admin:admin@localhost:8888/foo.html
+
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;two&gt;
+  &lt;one&gt;
+    &lt;foo ...sling:resourceType=&quot;xproc&quot; text=&quot;And some text&quot;
title=&quot;some title&quot;/&gt;
+  &lt;/one&gt;
+&lt;/two&gt;
+</PRE>
+</DIV></DIV>
+
+<P>In this case, the node&acute;s document view has been the pipeline&acute;s
source.</P>
+
+<P>5. Now, store an static XML in the repository:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><B>/foo.xml</B></DIV><DIV class="codeContent
panelContent">
+<PRE class="code-xml">
+<SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>
encoding=<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>?&gt;</SPAN>
+<SPAN class="code-tag">&lt;foo&gt;</SPAN>
+	<SPAN class="code-tag">&lt;content&gt;</SPAN>
+		foo: static content
+	<SPAN class="code-tag">&lt;/content&gt;</SPAN>
+<SPAN class="code-tag">&lt;/foo&gt;</SPAN>
+</PRE>
+</DIV></DIV>
+
+<P>6. Again, request foo.html to execute the pipeline:</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent
panelContent">
+<PRE>$ curl http://admin:admin@localhost:8888/foo.html
+
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;two&gt;
+  &lt;one&gt;
+    &lt;foo&gt;
+	&lt;content&gt;
+	  foo: static content
+	&lt;/content&gt;
+    &lt;/foo&gt;
+  &lt;/one&gt;
+&lt;/two&gt;
+</PRE>
+</DIV></DIV>
+
+<P>This time the pipeline&acute;s source has been an static XML file.</P>
+
+<P>7. Store an script in the repository:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><B>/apps/xproc/xproc.xml.esp</B></DIV><DIV
class="codeContent panelContent">
+<PRE class="code-xml">
+<SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>
encoding=<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>?&gt;</SPAN>
+<SPAN class="code-tag">&lt;foo&gt;</SPAN>
+	<SPAN class="code-tag">&lt;content&gt;</SPAN>
+		foo: dynamic content
+	<SPAN class="code-tag">&lt;/content&gt;</SPAN>
+<SPAN class="code-tag">&lt;/foo&gt;</SPAN>
+</PRE>
+</DIV></DIV>
+
+<P>8. Delete previous static xml file (/foo.xml).</P>
+
+<P>9. Request foo.html to execute the pipeline:</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent
panelContent">
+<PRE>$ curl http://admin:admin@localhost:8888/foo.html
+
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;two&gt;
+  &lt;one&gt;
+    &lt;foo&gt;
+	&lt;content&gt;
+	  foo: dynamic content
+	&lt;/content&gt;
+    &lt;/foo&gt;
+  &lt;/one&gt;
+&lt;/two&gt;
+</PRE>
+</DIV></DIV>
+
+<P>This time the pipeline&acute;s source has been a dinamically generated XML.</P>
+
+<H2><A name="XSLTProcessingPipeline-References"></A>References</H2>
+
+<UL>
+	<LI><A href="http://cocoon.apache.org/3.0/" class="external-link" rel="nofollow">Cocoon
3 pipeline engine</A></LI>
+	<LI><A href="http://www.w3.org/TR/xproc/" class="external-link" rel="nofollow">W3C
XProc language</A></LI>
+	<LI><A href="https://issues.apache.org/jira/browse/SLING-893" class="external-link"
rel="nofollow">SLING-893</A></LI>
+	<LI><A href="http://markmail.org/thread/33h5nhk5e3mswrue" class="external-link"
rel="nofollow">Mail list discussion</A></LI>
+</UL>
+
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by jvazquez on 2009-04-07 02:46:22.0
+        </DIV>
+        <DIV class="trademarkFooter">
+Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are
trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks
or registered trademarks of their respective owners.
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/xslt-processing-pipeline.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/xslt-processing-pipeline.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/xslt-processing-pipeline.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/xstl-processing-pipeline.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/xstl-processing-pipeline.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/xstl-processing-pipeline.html (added)
+++ sling/site/trunk/content/site/xstl-processing-pipeline.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,135 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - XSTL Processing Pipeline</TITLE>
+    <LINK rel="stylesheet" href="http://incubator.apache.org/sling/site/media.data/site.css"
type="text/css" media="all">
+    <LINK rel="icon" href="http://incubator.apache.org/sling/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://incubator.apache.org/sling/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://incubator.apache.org/sling/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://incubator.apache.org/">
+          <IMG border="0" alt="Apache Incubator" src="http://incubator.apache.org/images/apache-incubator-logo.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+
+            
+                        
+                                    
+                                                
+            
+
+<UL>
+	<LI><A href="documentation.html" title="Documentation">Documentation</A></LI>
+	<LI><A href="advanced-topics.html" title="Advanced Topics">Advanced Topics</A></LI>
+	<LI><A href="development.html" title="Development">Development</A></LI>
+	<LI><SPAN class="nobr"><A href="http://incubator.apache.org/sling/site/downloads.cgi"
title="Visit page outside Confluence" rel="nofollow">Downloads<SUP><IMG class="rendericon"
src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle"
alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><A href="contributing.html" title="Contributing">Contributing</A></LI>
+	<LI><A href="links.html" title="Links">Links</A></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/SLING/faq.html" title="Visit
page outside Confluence" rel="nofollow">FAQ<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif"
height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/SLING/" title="Visit
page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif"
height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><A href="project-information.html" title="Project Information">Project Information</A></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/thanks.html"
title="Visit page outside Confluence" rel="nofollow">Sponsors<SUP><IMG class="rendericon"
src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle"
alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/sponsorship.html"
title="Visit page outside Confluence" rel="nofollow">Sponsorship<SUP><IMG class="rendericon"
src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle"
alt="" border="0"></SUP></A></SPAN>
+
+<IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left"
frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+<P style="height: 100px">
+</LI>
+</UL>
+                                                                                        
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                   </DIV>
+    <DIV class="main">
+
+
+<P>In the <EM>Apache Sling Scripting W3C XML Processing Support</EM> bundle,
Juan Jo Vazquez has implemented XLST processing support for Sling as another new scripting
engine.</P>
+
+<TABLE cellpadding="5" width="85%" cellspacing="8px" class="noteMacro" border="0" align="center"><COLGROUP><COL
width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif"
width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B class="strong">Simple</B><BR>
+<P>This is the first very simple sample which Bertrand Delacretaz has posted to Sling
developers list. More samples and completion to come.</P></TD></TR></TABLE>
+
+
+
+<P>1. Install the <TT>org.apache.sling.scripting.xproc</TT> bundle by either
building it from <TT>contrib/scripting/xproc</TT> folder in the Sling trunk or
by dowloading it from the Apache Snapshot repository here: <SPAN class="nobr"><A
href="http://people.apache.org/repo/m2-snapshot-repository/org/apache/sling/org.apache.sling.scripting.xproc/2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar"
title="Visit page outside Confluence" rel="nofollow">org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar<SUP><IMG
class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7"
width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></P>
+
+<P>2. Create some content</P>
+
+<DIV class="preformatted"><DIV class="preformattedContent">
+<PRE>$ curl -F sling:resourceType=xproc -F title=&quot;some title&quot; -F
text=&quot;And some text&quot; http://admin:admin@localhost:8888/foo
+</PRE>
+</DIV></DIV>
+
+<P>3. Create a pipeline script at <TT>/apps/xproc/xproc.xpl</TT> :</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>
encoding=<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>?&gt;</SPAN>
+<SPAN class="code-tag">&lt;p:pipeline <SPAN class="code-keyword">xmlns:p</SPAN>=<SPAN
class="code-quote">&quot;http://www.w3.org/ns/xproc&quot;</SPAN>&gt;</SPAN>
+
+  <SPAN class="code-tag">&lt;p:xslt&gt;</SPAN>
+    <SPAN class="code-tag">&lt;p:input port=<SPAN class="code-quote">&quot;stylesheet&quot;</SPAN>&gt;</SPAN>
+      <SPAN class="code-tag">&lt;p:document href=<SPAN class="code-quote">&quot;/apps/xproc/one.xsl&quot;</SPAN>/&gt;</SPAN>
+    <SPAN class="code-tag">&lt;/p:input&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/p:xslt&gt;</SPAN>
+
+  <SPAN class="code-tag">&lt;p:xslt&gt;</SPAN>
+    <SPAN class="code-tag">&lt;p:input port=<SPAN class="code-quote">&quot;stylesheet&quot;</SPAN>&gt;</SPAN>
+      <SPAN class="code-tag">&lt;p:document href=<SPAN class="code-quote">&quot;/apps/xproc/two.xsl&quot;</SPAN>/&gt;</SPAN>
+    <SPAN class="code-tag">&lt;/p:input&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/p:xslt&gt;</SPAN>
+
+<SPAN class="code-tag">&lt;/p:pipeline&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<P>4. Store the XSLT transforms in the repository:</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>/apps/xproc/one.xsl</B></DIV><DIV
class="codeContent">
+<PRE class="code-xml">&lt;<SPAN class="code-keyword">xsl:stylesheet</SPAN>
version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>
+    <SPAN class="code-keyword">xmlns:xsl</SPAN>=<SPAN class="code-quote">&quot;http://www.w3.org/1999/XSL/Transform&quot;</SPAN>
+&gt;
+
+<SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:template</SPAN>
match=<SPAN class="code-quote">&quot;/&quot;</SPAN>&gt;</SPAN>
+  <SPAN class="code-tag">&lt;one&gt;</SPAN>
+    <SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:copy-of</SPAN>
select=<SPAN class="code-quote">&quot;.&quot;</SPAN>/&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/one&gt;</SPAN>
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:template</SPAN>&gt;</SPAN>
+
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:stylesheet</SPAN>&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<DIV class="code"><DIV class="codeHeader"><B>/apps/xproc/two.xsl</B></DIV><DIV
class="codeContent">
+<PRE class="code-xml">&lt;<SPAN class="code-keyword">xsl:stylesheet</SPAN>
version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>
+    <SPAN class="code-keyword">xmlns:xsl</SPAN>=<SPAN class="code-quote">&quot;http://www.w3.org/1999/XSL/Transform&quot;</SPAN>
+&gt;
+
+<SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:template</SPAN>
match=<SPAN class="code-quote">&quot;/&quot;</SPAN>&gt;</SPAN>
+  <SPAN class="code-tag">&lt;two&gt;</SPAN>
+    <SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:copy-of</SPAN>
select=<SPAN class="code-quote">&quot;.&quot;</SPAN>/&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/two&gt;</SPAN>
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:template</SPAN>&gt;</SPAN>
+
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:stylesheet</SPAN>&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<P>5. Request foo.html to execute the pipeline:</P>
+
+<DIV class="preformatted"><DIV class="preformattedContent">
+<PRE>$ curl http://admin:admin@localhost:8888/foo.html
+
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;two&gt;
+  &lt;one&gt;
+    &lt;foo ...sling:resourceType=&quot;xproc&quot; text=&quot;And some text&quot;
title=&quot;some title&quot;/&gt;
+  &lt;/one&gt;
+&lt;/two&gt;
+</PRE>
+</DIV></DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/xstl-processing-pipeline.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/xstl-processing-pipeline.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/xstl-processing-pipeline.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message