You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by System Administrator <ro...@black-dog-consultants.co.uk> on 2002/06/18 20:40:35 UTC

RE: Pass a xsl variable as a esql tag parameter?

This is inside a logicsheet. 

I have a database configuration xml schema. 
I am attempting to create an xsp page from the 
database xml, which will perform database actions on 
the fields defined in the xml. 

On creating the xsp page, I have defined table tags. 

On executing the xsp page, I need to get attributes 
from the table tags and use a column name to perform a 
database query. 

the "column1" part of the code is really a 
<xsl:value-of select="@columnName"> 


Regards 
Graeme. 

--- Stephen Ng <st...@verizon.net> wrote: > 
(Correct me if I'm wrong...) An xsp file is not an 
> xslt stylesheet; xsl 
> commands won't work in an xsp. 
> 
> Steve 
> 
> > -----Original Message----- 
> > From: System Administrator 
> [mailto:root@black-dog-consultants.co.uk] 
> > Sent: Tuesday, June 18, 2002 12:33 PM 
> > To: cocoon-users@xml.apache.org 
> > Subject: Pass a xsl variable as a esql tag 
> parameter? 
> > 
> > 
> > Hi all, 
> > 
> > I'm having problems passing an xsl variable as a 
> parameter to esql. 
> > 
> > 1 - I am defining a column name as a variable 
> called col1. 
> > 2 - I want to use this variable as the column 
> value in the 
> > <esql:get-string > tag. 
> > 
> > This is not working, producing a language 
> exception 
> > 
> > 
> > <xsl:variable name="col1"> 
> >    column1 
> > </xsl:variable> 
> > 
> > 
> > <esql:results> 
> >     <esql:row-results> 
> >        <esql:get-string column="{$col1}" /> 
> >     </esql:row-results> 
> > </esql:results> 
> > 
> > 
> > Is this the right way to do this? 
> > 
> > Any help appreciated. 
> > 
> > Regards 
> > Graeme Colman. 
> > 
> > 
> > 
> >   
> >                     
> > 
> > 
> 
-------------------------------------------------------------------
-- 
> > Please check that your question  has not already 
> been answered in the 
> > FAQ before posting.     
> <http://xml.apache.org/cocoon/faq/index.html> 
> > 
> > To unsubscribe, e-mail:     
> <co...@xml.apache.org> 
> > For additional commands, e-mail:   
> <co...@xml.apache.org> 
> > 
>   



 
                   

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Pass a xsl variable as a esql tag parameter?

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 18.Jun.2002 -- 07:40 PM, System Administrator wrote:
> This is inside a logicsheet. 
> 
> I have a database configuration xml schema. 
> I am attempting to create an xsp page from the 
> database xml, which will perform database actions on 
> the fields defined in the xml. 
> 
> On creating the xsp page, I have defined table tags. 
> 
> On executing the xsp page, I need to get attributes 
> from the table tags and use a column name to perform a 
> database query. 
> 
> the "column1" part of the code is really a 
> <xsl:value-of select="@columnName"> 
> 
> > > I'm having problems passing an xsl variable as a 
> > parameter to esql. 
> > > 
> > > 1 - I am defining a column name as a variable 
> > called col1. 
> > > 2 - I want to use this variable as the column 
> > value in the 
> > > <esql:get-string > tag. 
> > > 
> > > This is not working, producing a language 
> > exception 
> > > 
> > > 
> > > <xsl:variable name="col1"> 
> > >    column1 
> > > </xsl:variable> 
> > > 
> > > 
> > > <esql:results> 
> > >     <esql:row-results> 
> > >        <esql:get-string column="{$col1}" /> 
> > >     </esql:row-results> 
> > > </esql:results> 
> > > 
> > > 
> > > Is this the right way to do this? 

Yes. I assume that {$col1} is a static value since your XSP would need
to be regenerated manually after every schema change.

The biggest problem I see with your code is the whitespace around the
column name. The JDBC driver will most likely not consider "column1"
and "
column1
" as equal. (linebreaks were intended!) Eliminate all whitespace in
your variable or use XSLT functions to trim it.

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Pass a xsl variable as a esql tag parameter?

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: System Administrator [mailto:root@black-dog-consultants.co.uk]
> 
> This is inside a logicsheet.

I won't recommend using construct like 

<esql:get-string column="{$col1}" />


Must be something like:

<esql:get-string>
  <esql:param
name="column"><xsp:logic>sColumnName</xsp:logic></esql:param>
</esql:get-string>



(Disclaimer: Not a user of ESQL logicsheet, syntax may be a bit
incorrect)

Vadim
 
> I have a database configuration xml schema.
> I am attempting to create an xsp page from the
> database xml, which will perform database actions on
> the fields defined in the xml.
> 
> On creating the xsp page, I have defined table tags.
> 
> On executing the xsp page, I need to get attributes
> from the table tags and use a column name to perform a
> database query.
> 
> the "column1" part of the code is really a
> <xsl:value-of select="@columnName">
> 
> 
> Regards
> Graeme.
> 
> --- Stephen Ng <st...@verizon.net> wrote: >
> (Correct me if I'm wrong...) An xsp file is not an
> > xslt stylesheet; xsl
> > commands won't work in an xsp.
> >
> > Steve
> >
> > > -----Original Message-----
> > > From: System Administrator
> > [mailto:root@black-dog-consultants.co.uk]
> > > Sent: Tuesday, June 18, 2002 12:33 PM
> > > To: cocoon-users@xml.apache.org
> > > Subject: Pass a xsl variable as a esql tag
> > parameter?
> > >
> > >
> > > Hi all,
> > >
> > > I'm having problems passing an xsl variable as a
> > parameter to esql.
> > >
> > > 1 - I am defining a column name as a variable
> > called col1.
> > > 2 - I want to use this variable as the column
> > value in the
> > > <esql:get-string > tag.
> > >
> > > This is not working, producing a language
> > exception
> > >
> > >
> > > <xsl:variable name="col1">
> > >    column1
> > > </xsl:variable>
> > >
> > >
> > > <esql:results>
> > >     <esql:row-results>
> > >        <esql:get-string column="{$col1}" />
> > >     </esql:row-results>
> > > </esql:results>
> > >
> > >
> > > Is this the right way to do this?
> > >
> > > Any help appreciated.
> > >
> > > Regards
> > > Graeme Colman.


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>