[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: using variables correctly

Subject: RE: using variables correctly
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 2 Jun 2003 16:31:53 +0100
RE:  using variables correctly
You are very confused. Variables represent values, they do not represent
bits of XPath expressions. They are not macros.

In the expression [../@owner=3] you can replace 3 by a variable
reference, because it is a value. You can also replace ../@owner by a
variable reference, so long as the value of the variable is the node-set
selected by the expression ../@owner - you can't replace it by a
variable whose value is the string "../@owner".

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Krueger, Philipp
> Sent: 02 June 2003 14:41
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx; 
> xsl-list-digest@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  using variables correctly
> 
> 
> i try to write a dynamical database using xsl-processing and 
> somehow i can't get the variables to work correctly:
> 
> <xsl:if test="$search != ''">
> <xsl:for-each select="database/computer[@owner = $searchparam]">
> 
> the if works, the for works as well, but only if i use 
> "@owner" - if i write the following line "<xsl:for-each 
> select="database/computer[$search = $searchparam]">" ($search 
> is "@owner") the output stays empty... now i
> wonder: why does comparing to a variable work with "xsl:if" 
> but not with "xsl:for-each"? i also tried setting the whole 
> content of the "select"-statement as a variable but that 
> neither worked ($search was "database/computer[@owner = 
> $searchparam]"). i also tried to set $search to $search = 
> "$searchparam" and use that as in "<xsl:for-each 
> select="database/computer[$search]">"but that neither worked. 
> i am desperate
> - can anybody help, please?
> 
> greetings,
> 
> philipp
> 
>  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.