This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to pass search path as variable and get back node list.
- From: "J.Pietschmann" <j3322ptm at yahoo dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 27 Mar 2002 22:40:40 +0100
- Subject: Re: [xsl] How to pass search path as variable and get back node list.
- References: <sca1e93d.038@mailbox.ers.usda.gov>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Andrew Kerns wrote:
> <xsl:param name="DATA_REQUEST_NAME"/>
>
> <xsl:variable name="ftype_search"
> select="concat('//JOB_REQUEST/DATA_REQUEST[@NAME=',$DATA_REQUEST_NAME,']/FILE_TYPE')"/>
You have assigned a string to the variable $ftype_search,
and it will stay a string, even if it looks like an XPath
expression. In most other languages, if you do
a="1 + 1";
b=a;
you usually don't expect that b is 2 afterwards.
Your problem is much simpler to solve, try this:
<xsl:variable name="ftype_search"
select="//JOB_REQUEST/DATA_REQUEST[@NAME=$DATA_REQUEST_NAME]/FILE_TYPE"/>
If you really want to pass more complicated expressions
as parameter values, like "1 + 1" or "/DATA_REQUEST[@NAME=$DATA_REQUEST_NAME]",
search the manual for your processor for an evaluate()
function, usually to be used like this:
<xsl:variable name="ftype_search"
select="xx:evaluate(concat('//JOB_REQUEST',$REQUEST))"/>
MSXML does not have an evaluate() function, use some
JScript in this case.
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list