Re: [xsl] using variables correctly

Subject: Re: [xsl] using variables correctly
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 2 Jun 2003 15:24:20 +0100

<xsl:for-each select="database/computer[$search = $searchparam]">" 

a variable holds a value not an unexecuted expression so
whether the variables search  and searchparam hold the same value
or not does not depend on the current node.

database/computer[$search = $searchparam]
is the same as
database/computer or the same as /.. depending on whether or not tehse
are equal.

  $search is "@owner"

so your expression is equivalent to

database/computer["@owner" = $searchparam]

and you will get the whole node set if searchparam is also the string
"@owner" and nothing otherwise.

I suspect you want

database/computer[@*[name()=$search] = $searchparam]

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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


Current Thread