This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using XSL Variables in HTML Attributes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]