Subject: RE: Concatenating multiple variables in a XPath statement
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 20 Jun 2006 08:12:43 +0100
|
You don't say what's in the variables.
If the variables hold element names, you can do
*[name()=$var1]/*[name()=$var2]
If the variables hold more than this, for example if they hold fragments of
XPath like "@att" or "following-sibling::text()" then this approach doesn't
work, you need to use an extension such as saxon:evaluate() which allows
dynamic construction of XPath expressions.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Mohsen Saboorian [mailto:mohsens@xxxxxxxxx]
> Sent: 20 June 2006 07:15
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Concatenating multiple variables in a XPath statement
>
> Hi,
> I want to know if it is possible to make a XPath with
> multiple variables, something like "$var1/$var2". This kind
> of query has errors. In fact I think that placing a "/" befor
> $ makes the problem.
> How can I use a query like this:
> <xsl:value-of select="/rootElement/body/$colName" /> or
> <xsl:value-of select="/$var1/$var2" />
>
> Thanks in advance.
|