xsl-list
[Top] [All Lists]

RE: How to assign a nodelist to a variable

2004-01-08 10:27:15
Call me old-school--but please consider switching to plain text (or at least
not use HTML-heavy stationery) when posting to this list.  Those among us
who pay by volume for their bandwidth will thank you.  ;-)

From: Robert A. van Ginkel [mailto:robert(_at_)stylegate(_dot_)com]
Sent: Thursday, January 08, 2004 10:01 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] How to assign a nodelist to a variable

so as u can see I want to put a value from XML through XSL in a XHTML
attribute. What I am doing doesn't work ofcourse, what will? writing a
function?

You need to read a bit more about the use of attribute value templates
(AVTs); see http://www.dpawson.co.uk/xsl/sect2/N1575.html#d1996e85.

In your example, you want to insert the value of the idx attribute from your
XML into the onclick attribute in your input element.  Attributes in result
elements require literal values, so simply trying to insert an XSLT element
into the attribute won't work.

With AVTs (delimited by curly braces {}) you can set the attribute value of
a result element using an XPath expression; so your input element becomes:

<input class="button" onclick="lgotoent('report(_dot_)php?view={(_at_)idx}')"/>

hth,
b.

| brian martinez                           
brian(_dot_)martinez(_at_)cendant(_dot_)com |
| lead gui programmer                                    303.357.3548 |
| cheap tickets, part of trip network                fax 303.357.3380 |
| 6560 greenwood plaza blvd., suite 400           englewood, co 80111 |
| cendant travel distribution services   http://www.cheaptickets.com/ |

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



<Prev in Thread] Current Thread [Next in Thread>