Thanks sp,

In the end I ended up using an xslt2/sql transformer combination: Xslt2
to generate the SQL query from my input XML; and SQL to actually
retrieve the results. E.g. 

XSL: 

<xsl:template match="results">
   <page>
       <title>Hello</title>
       <content>
            <sql:execute-query
xmlns:sql="http://apache.org/cocoon/SQL/2.0";> 
                <sql:query> 
                    select * from col1 where col2 in (<xsl:value-of
select="fn:pipeIds(idGroup)" />)
                </sql:query>
            </sql:execute-query>
        </content>
    </page>
</xsl:template>

<xsl:function name="fn:pipeIds">
    <xsl:param name="idBlock" as="element()*"/>   
    <xsl:for-each select="$idBlock/id">
        '<xsl:value-of select="." />'<xsl:if
test="following::id">,</xsl:if>
    </xsl:for-each>    
</xsl:function> 

Pipeline:

<map:pipeline>            
        <map:match pattern="*">
        <!-- Input XML -->
        <map:generate src="service-consumer:"/>
        <!-- Generate SQL query -->
        <map:transform type="xslt2" src="transforms/generateSQL.xsl" />
        <!-- Get mySQL results -->                
        <map:transform type="sql">
                <map:parameter name="use-connection"
value="myDataSource"/>
                <map:parameter name="show-nr-of-rows" value="true"/> 
                <map:parameter name="clob-encoding" value="UTF-8"/>
                <map:parameter name="guid" value="{1}"/>
        </map:transform>
        <map:serialize type="xml"/>
</map:match>           
</map:pipeline>

Thanks for your input.

Heather

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 11 July 2008 23:09
To: users@cocoon.apache.org
Subject: Re: call pipeline from XSLT

On 7/10/08, Heather Rankin <[EMAIL PROTECTED]> wrote:
>  I want to be able to call a pipeline from another pipeline's XSLT in 
> the  same sitemap. (The reason I need to call the pipeline from the 
> XSLT as  opposed to from the sitemap directly is because I need to 
> pass the XML  input data as parameters and I see no other way of doing

> this.)  Seems I should be able to use the xslt doc() function with the

> cocoon:/  protocol, e.g.
>  <xsl:for-each select="id">
>         <xsl:copy-of select="doc(concat('context:/pipeline4', .))" />

> </xsl:for-each>  However, I get a "MalformedURLException: unknown 
> protocol: cocoon"
>  error.
>  Is this because I'm calling pipeline4 within a nested serviceServlet

> 'chain'? E.g:
>  pipeline1 calls pipeline2 calls pipeline 3 (which calls pipeline4 via

> the XSLT)
>
>  (This is actually part of a bigger issue: I'd like to call an 
> external  Block from within an XSLT but I wanted to get the answer to 
> this  question first and then go from there...)  Heather

IIUC, you want to lookup many entries based on data in the XML.  You
have not mentioned what handles the lookup.  If you use the
SQLTransformer, the second transformation adds several sql:execute-query
elements.  The third transformation calls the SQLTransformer.  A fourth
transformation may be needed to format the results of the the third
transformation if they do not insert the desired HTML.

This is a straight pipeline.  No transformation inserts data from
another pipeline; each just inserts the information needed for the next
step.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal 
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on 
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to