[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
RE: displaying sql results in dropdown menus
Subject: RE: displaying sql results in dropdown menus
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Fri, 20 Aug 2004 16:56:23 +0000
|
<option value= "$idattr1">
> <xsl:value-of select="$idattr2"/>
> </option>
There is a problem is in the above code..
you must use a curly brackets around the value.. like
<option value= "{idattr1}>
<xsl:value-of select="$idattr2"/>
</option>
You must use curly brackets when printing an attribute value which is not
hard coded...
this is also referred to as attribute-value template..
Try This .. If ii works, Then I have understood your problem correctly.If
not then please give more information and explain your problem better.
HTH
Vasu
From: Matt Rich <mattaios@xxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: displaying sql results in dropdown menus Date: Thu, 19 Aug
2004 09:53:17 +0200
Hello!
I'm trying to get dropdown menus of values from a xml file, which is the
result of a SQL request:
<td>Collection</td>
// here I caught the names of the request's attributes
<idattr>sql:id_collection</idattr>
<idattr>sql:libelle_collection</idattr>
<td>
<rowset xmlns="http://apache.org/cocoon/SQL/2.0"
nrofrows="12">
<row>
<id_collection>1</id_collection>
<libelle_collection>CIP</libelle_collection>
</row>
<row>
<id_collection>2</id_collection>
<libelle_collection>Champignons</libelle_collection>
</row>
<row>
<id_collection>3</id_collection>
<libelle_collection>IEBC</libelle_collection>
</row>
</rowset>
</td>
I modified the XSL file page2html.xsl in the following way:
(I don't directly put the attributes' id s in the xsl because I want a
generalized file,
which could work for any request' s result)
<xsl:template match="sql:rowset">
// I catch the attributes' ids in xsl variables
<xsl:variable name="idattr1" select="../../idattr[1]"/>
<xsl:variable name="idattr2" select="../../idattr[2]"/>
<select size="1" name="">
<option value="-1">- Silectionnez :</option>
// And I try to get their values in a dropdown list
<xsl:for-each select="sql:row">
<option value= "$idattr1">
<xsl:value-of select="$idattr2"/>
</option>
</xsl:for-each>
</select>
...
All I manage to obtain is :
<td>Collection</td>
<td>
<select name="" size="1">
<option value="-1">- Silectionnez :</option>
<option value="$idattr1">sql:libelle_collection</option>
<option value="$idattr1">sql:libelle_collection</option>
<option value="$idattr1">sql:libelle_collection</option>
</select></td>
instead of the dropdown list with the values INSIDE the "
libelle_collection" tags...
Perhaps it is a problem with Cocoon's SQL Transformer...
Has anybody a clue?
Many many thanks in advance for your help!!
Matt
_________________________________________________________________
Express yourself with cool new emoticons
http://www.msn.co.uk/specials/myemo
_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today!
http://www.msn.co.uk/messenger
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|