Andrew
I assume you are familar with the essentials of setting up a mySQL connection to Cocoon... you will then need a few "parts" to assemble this. 1. An entry in the form definition: <fd:field id="special"> <fd:label>My Field Label</fd:label> <fd:datatype base="string"/> <!-- from internal pipeline... database --> <fd:selection-list src="cocoon:/form-sql/my-data.xml" dynamic="true"/> </fd:field> 2. And an entry in the sitemap to create the XML. <map:match pattern="form-sql/*"> <map:generate src="data-docs/{1}"/> <!-- === SQL Connector ==== --> <map:transform type="sql"> <map:parameter name="use-connection" value="my-connection"/> <map:parameter name="show-nr-of-rows" value="true"/> <map:parameter name="clob-encoding" value="UTF-8"/> </map:transform> <map:transform src="stylesheets/widget-theme.xsl"/> <map:serialize type="xml"/> </map:match> 3. The XML for the SQL will look something like: <?xml version="1.0" encoding="UTF-8"?> <fd:selection-list xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" > <sq2:execute-query xmlns:sq2="http://apache.org/cocoon/SQL/2.0"> <sq2:query name="themes"> <!-- here comes the SQL statement or stored procedure --> SELECT * FROM MyTable </sq2:query> </sq2:execute-query> </fd:selection-list> 4. And then you can transform this with a stylesheet suited to your data e.g. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" xmlns:sq2="http://apache.org/cocoon/SQL/2.0" > <!-- root --> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="fd:selection-list"> <fd:selection-list> <xsl:apply-templates select="sq2:rowset"/> </fd:selection-list> </xsl:template> <!-- rowset --> <xsl:template match="sq2:rowset"> <xsl:apply-templates select="sq2:row"/> </xsl:template> <!-- row --> <xsl:template match="sq2:row"> <fd:item value="{sq2:field-name-1}"><fd:label><xsl:value-of select="sq2:field-name-2"/></fd:label></fd:item> </xsl:template> </xsl:stylesheet> I hope there is enough here for you to get started! Cheers Derek (Dont let the Aussies say a South African never helped them!!) >>> [EMAIL PROTECTED] 2004/10/11 07:19:26 AM >>> My apologies for what I am sure is an easy question. I am trying to think of how I should populate a cocoon forms selection list field from a MySQL query. I have a form definition and a form template working fine as is and I can get my sql query to serialise its results in a web browser but now I would like to use these results to populate one of the selection list fields in my form as part of the generation process. One of the samples hints at how to do this but my grasp of cocoon is still quite weak and some tips would be appreciated. Thanks in Advanced Andrew Miller -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks transtec Computers for their support. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]