[oXygen-user] External data from XQuery in Transformation Scenario.

Florent Georges
Thu Feb 5 10:36:06 CST 2009


Sorin Ristache wrote:

  Hi,

> Also you can set up an XProc scenario and run it as a
> single action from Oxygen with an integration of an XProc
> processor, as in Florent's example (he posted a message
> about it to this mailing list too):

>http://fgeorges.blogspot.com/2008/10/poor-mans-calabash-integeration-into.html
>http://fgeorges.blogspot.com/2008/11/xproc-with-xslt-completion-in-oxygen.html

  Out of interest, Mike can use something like the following if he wants to follow that road:

<p:pipeline xmlns:p="http://www.w3.org/ns/xproc"
            xmlns:c="http://www.w3.org/ns/xproc-step"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:e="http://exist.sourceforge.net/NS/exist">

   <!-- query eXist through its REST interface -->
   <p:http-request name="hello">
      <p:input port="source">
         <p:inline>
            <c:request href="http://localhost:8080/exist/rest/db"
                       method="post" username=".." password="..">
               <c:body content-type="application/xml">
                  <e:query>
                     <e:text>concat('Hello, ', 'world!')</e:text>
                  </e:query>
               </c:body>
            </c:request>
         </p:inline>
      </p:input>
   </p:http-request>

   <!-- enrich the docbook document with data from eXist -->
   <p:xslt name="enrich">
      <p:input port="source">
         <p:document href="mike-starov.xml"/>
         <p:pipe port="result" step="hello"/>
      </p:input>
      <p:input port="stylesheet">
         <p:inline>
            <xsl:stylesheet version="2.0">
               <!-- identity template pattern -->
               <xsl:template match="@*|node()">
                  <xsl:copy>
                     <xsl:apply-templates select="@*|node()"/>
                  </xsl:copy>
               </xsl:template>
               <!-- add a PI before the title elements -->
               <xsl:template match="title">
                  <xsl:processing-instruction name="pi">
                     <xsl:value-of select="collection()[2]/*"/>
                  </xsl:processing-instruction>
                  <xsl:next-match/>
               </xsl:template>
            </xsl:stylesheet>
         </p:inline>
      </p:input>
   </p:xslt>

   <!-- transform the resulting docbook document -->   
   <p:xslt name="format">
      <p:input port="source">
         <p:pipe port="result" step="enrich"/>
      </p:input>
      <!-- the stylesheet you use to format the resulting docbook
           document -->
      <p:input port="stylesheet">
         ...
      </p:input>
   </p:xslt>

</p:pipeline>

  Hope that helps,

-- 
Florent Georges
http://www.fgeorges.org/























      __________________________________________________________________________________________________
Ne pleurez pas si votre Webmail ferme ! Récupérez votre historique sur Yahoo! Mail ! http://fr.docs.yahoo.com/mail/transfert_mails.html



More information about the oXygen-user mailing list