xsl-list
[Top] [All Lists]

RE: [xsl] Concatenating multiple variables in a XPath statement

2006-06-20 00:13:03
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(_at_)gmail(_dot_)com] 
Sent: 20 June 2006 07:15
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--