cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bierenfeld <>
Subject Q: java loops and tags
Date Tue, 02 Jan 2001 16:21:17 GMT

happy new year ! I am having a small problem with xslt and xsp :

the following xsp-sniplet is used to retrieve records out of a database.
These records should be displayed as a select field in html :

The Records are already fetched and stored in a vector.

<xsl:template match="select">

   <select>      <!-- To be transformed to the html-tag "select" later
on -->


   Vector records = database.fetchAll ();   // Whatever

   for (int i=0; i &lt; records.size (); i++) {

	Record record = (Record) record.elementAt (i);

	<option>   <!-- to be tranformed i times to the html-tag "option" -->

           <xsp:attribute name="value">

		<xsp:expr>record.getField ("whatever")</xsp:expr>



		<xsp:expr>record.getField ("whatever2")</xsp:expr>


	</option>            <!-- THIS ONE IS MISSING -->



   <xsl:copy-of select="@*">



"<select>" and "option" are further more handled by :

<xsl:template match="select">

  <select size="{@size}>


<xsl:template match="option">

  <option value="{@value}>


Its working somewhat correct. The result with the additional templates

   <option value="1">Description 1
   <option value="2"> and so on...

** But the closing </option> tag is missing. I think I am on the wrong
way somewhat.

Kind regards


View raw message