[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] About source-attributes in result-attributes


Subject: Re: [xsl] About source-attributes in result-attributes
From: "Robert A. van Ginkel" <robert@xxxxxxxxxxxxx>
Date: Fri, 9 Jan 2004 09:31:31 +0100

Thanx,

Sorry, for the HTML shell I thought it was filtered at mulberry's...

What I think is strange in:
<input class="button" onclick="lgotoent('report.php?view={@idx}')"/>
is that @idx doesn't have a x-path/namespace ref.
So you create a new element and within the attribute of that new element u
use data from the source xml by using a direct assignment of a variable.
but if i really really wanted to print
<input class="button" onclick="lgotoent('report.php?view={@idx}')"/>
litterary to the target document what would be the syntax of that.


----- Original Message ----- 
From: Martinez, Brian
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Sent: Thursday, January 08, 2004 6:27 PM
Subject: RE: [xsl] How to assign a nodelist to a variable


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@xxxxxxxxxxxxx]
> Sent: Thursday, January 08, 2004 10:01 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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.php?view={@idx}')"/>

hth,
b.

| brian martinez                           brian.martinez@xxxxxxxxxxx |
| 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


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



Current Thread
Keywords