Re: [xsl] Using XSL Variables in HTML Attributes

Subject: Re: [xsl] Using XSL Variables in HTML Attributes
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 12 Jun 2002 21:23:48 +0200
Use so called "Attribute Value Templates":

<option value="{$courseTitle}">
   <xsl:value-of select="$courseNo" />
</option>

Or <xsl:attribute/>:

<option>
   <xsl:attribute name="value">
      <xsl:value-of select="$courseTitle"/>
   </xsl:attribute>
   <xsl:value-of select="$courseNo"/>
</option>

Of course the first one is shorter and mostly easier to read.

Regards,

Joerg



Jesse M. Heines wrote:
I have some values stored in XSL variables:

   <xsl:variable name="courseNo" select="@crsno" />
   <xsl:variable name="courseTitle"
select="//course[@number=$courseNo]/title" />

I can create a dropdown list of course numbers with HTML option tags by
putting the following code inside an appropriate looping structure:

   <option>
      <xsl:value-of select="$courseNo" />
   </option>

I want to use the course titles as the value parameters of the HTML
option tag, but the following doesn't work:

   <option value="$courseTitle">
      <xsl:value-of select="$courseNo" />
   </option>

I have tried various ways to get <xsl:value-of select="$courseTitle" />
inside the quotes for the option value parameter, but nothing I tried
works.  I also tried using the XPath string function in a number of ways
to no avail.

I would appreciate suggestions anyone can make on how to accomplish our
goal.

Thank you,
Jesse

~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jesse M. Heines, Ed.D.

Associate Professor
Dept. of Computer Science
University of Massachusetts Lowell
Lowell, MA  01854-2881



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list





XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread