Are people still writing apps in XSP?  I thought that usage
of XSP was deprecated and that it had long been supplanted 
by other, more robust, technologies and techniques.
 
FWIW, the way I do this is to use an SQLTransformer and 
stylesheet combo:
 
1.  The query (say, XYZ-lookup.xml):
 
<?xml version="1.0" encoding="UTF-8"?>
<page
  xmlns:sql="http://apache.org/cocoon/SQL/2.0";
>
  <sql:execute-query> 
    <sql:query name="theme-list">
      SELECT FieldA AS id, FieldB AS data  FROM myTable
    </sql:query>
  </sql:execute-query>
</page>
 
 
2. The stylesheet (say, keys2list.xsl):
 
<xsl:stylesheet 
  version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:sql="http://apache.org/cocoon/SQL/2.0";
  >
<xsl:template match="/"><xsl:apply-templates
select="page"/></xsl:template>
 
<xsl:template match="page">
  <xsl:apply-templates select="sql:rowset"/>
</xsl:template>
 
<xsl:template match="sql:rowset">
<select name="theme" class="frmField">
  <xsl:apply-templates select="sql:row"/>
</select>
</xsl:template>
 
<xsl:template match="sql:row"><option value="{sql:id}"><xsl:value-of
select="sql:data"/></option></xsl:template>
 
</xsl:stylesheet>
 
 
3.  And the pipeline match:
 
<map:match pattern="lookup-*">
  <map:generate src="queries/lookup/{1}-lookup.xml" type="jx" >
    <use-request-parameters>true</use-request-parameters>
  </map:generate> 
  <map:transform type="sql">
      <map:parameter name="use-connection" value="myConnection"/>
      <map:parameter name="show-nr-of-rows" value="true"/> 
      <map:parameter name="clob-encoding" value="UTF-8"/> 
    </map:transform> 
  <map:transform src="stylesheets/lookup/keys2list.xsl">
    <use-request-parameters>true</use-request-parameters>
  </map:transform>
  <map:serialize />
</map:match>
 
 
4. And the call from the form would be:
 
<fd:selection-list  src="cocoon:/db/lookup-XYZ" dynamic="true"/>
 
 
5. Obviously, adding new lookup lists would simply be a matter of
adding
new XML files with new queries (using the same field renaming
convention
so as to be able to reuse the stylesheet), named so that they can be
"found"
by the same pipeline.
 
Hope this helps!
 
Derek 

>>> [EMAIL PROTECTED] 2006/07/04 11:22 PM >>>

Jason Johnston wrote:
> > how to make a SQL query in javascript.
> 
> It can be done, though the syntax isn't quite as nice.

I'd like to give it a try, if the syntax isn't unbearable.
Do you have any pointers?

Although most of all I'd rather do it in ESQL in an XSP page and then
somehow call it from javascript and get an array out of the xml
produced.  Is there a way to do that?


> But there's also JavaSelectionList, which mysteriously doesn't
appear
> to be in the published user docs.  It sounds like this is closer to
> what you're looking for.

Thanks, that's quite fitting to what I need.  Although I'd still
rather
do it in XSP, for consistency with all the other DB queries in this
app.

Thinking about it, I could write an XSP-JavaSelectionList
logicsheet...


Toby

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



-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
 
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
 
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 
 
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
[EMAIL PROTECTED]


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


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

Reply via email to