passing parameters from xsl to cgi script

L

lievemario

I have made a perl script witch gets information out of a database,
transfers it into an xml-file file and than I parse this to a html document
using xsl.
The problem is dat the html doc needs a parameter which can be found in the
xml file.
I've done something like
<xsl:variable name="id" select="person_id"/>
<a href="http://localhost/CGI/detailsselection.cgi?ID=$id"><xsl:value-of
select="name"></xsl:value-of><xsl:value-of
select="first_name"></xsl:value-of></a>

Of course this doesn't give me the value of the id-variable. But it just
returns $id.
How can I solve this?

Thanks

L
 
M

Morris M. Keesan

I have made a perl script witch gets information out of a database,
transfers it into an xml-file file and than I parse this to a html document
using xsl.
The problem is dat the html doc needs a parameter which can be found in the
xml file.
I've done something like
<xsl:variable name="id" select="person_id"/>
<a href="http://localhost/CGI/detailsselection.cgi?ID=$id"><xsl:value-of
select="name"></xsl:value-of><xsl:value-of
select="first_name"></xsl:value-of></a>

Of course this doesn't give me the value of the id-variable. But it just
returns $id.
How can I solve this?

This should work -- instead of putting the $id variable into the href
attribute directly in the <a> tag, make the href into an xsl:attribute,
and then you can do fancier processing of it in the contents of that xsl
element:

<a>
<xsl:attribute name="href">
<xsl:value-of

select="concat('http://localhost/CGI/detailsselection.cgi?ID=',$id)"/>
</xsl:attribute>
<xsl:value-of select="name"/> <xsl:value-of select="first_name"/>
</a>

(Note also that since your <xsl:value-of> elements selecting the name
and first name don't have any contents, I've normalized them into
self-closing tags, instead of having separate </xsl:value-of> closing
tags.
 
L

lievemario

Another question about this:

So now I have passed the id, and I would like to use it in an sql query,
but the combination
my $id = param('id');
and
select .....where id = $id;
gives an error

is there a solution for this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,835
Latest member
lila30

Latest Threads

Top