This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: paramter passing problem
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] paramter passing problem
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Sat, 10 Mar 2001 17:35:44 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
I need a standard paragraph for this one: XSLT variables can only be used to
hold values, not XPath expressions or parts of expressions. You are testing
whether First_Name contains the string "$First_Name", not whether it
contains the value of the First_Name parameter.
In simple cases where the expression is a name, you can use
*[name()=$param].
Otherwise you need the evaluate() extension function in Saxon, Xalan, and
possibly other processors by now.
Mike Kay
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Dom
> Sent: 10 March 2001 16:41
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] paramter passing problem
>
>
> Hi,
>
> I have an xsl stylesheet that does a basic search through an xml file.
> I am using two paramters that I am passing in from a webpage.
>
> Param1 Value of search string (taken from text box)
> Param2 Category of search specified through drop down menu
>
> ***
> <xsl:if
> test="contains(translate($param1,'abcdefghijklmnopqrstuvwxyz',
> 'ABCDEFGHIJKLM
> NOPQRSTUVWXYZ'),(translate($param2,'abcdefghijklmnopqrstuvwxyz
> ','ABCDEFGHIJK
> LMNOPQRSTUVWXYZ')))" >
> ***
>
> $param2 has any of the following values:
> First_Name
> Title
> ISBN
> Author
>
> passed into using JavaScript. This relates to my xml file
> which has the
> basic structure
>
> <Book>
> <Title> </Title>
> <Author> </Author>
> <ISBN> </ISBN>
> <First_Name> </First_Name>
> </Book>
>
> It however does not work, if however I hard code, for example
> First_Name in
> place of $param2 the search works fine.
>
> Could any one please help.
> Many thanks
> Dom
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.237 / Virus Database: 115 - Release Date: 07/03/2001
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list