Re: dynamicaly build select expression
No, you can not use it as a string! You only can enhance Guillaume's example to 2 nodes or more. But the number of the nodes to test is static: <xsl:variable name="node1">n1</xsl:variable> <xsl:variable name="node2">n2</xsl:variable> <xsl:value-of select="/n0/*[name()=$node1]/*[name()=$node2]/n3"/> A further version, not very nice, contrary very poor, could be the following: Match on all n3, build a string of all the names of the ancestors with the '/' as delimiter and compare this string to your variable some_name from your first mail. And a third: Match on n0, from there match on this node, which has the name substring-before($some_name,'/') and give the substring-after($some_name,'/') to the next template (xsl:with-param). Do this until the param $some_name is empty. Regards, Joerg ----- Original Message ----- From: "Dmitri Ilyin" <dmitri.ilyin@xxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, September 13, 2001 5:57 PM Subject: RE: dynamicaly build select expression > thanks > > will it also work if i have: > <xsl:variable > name="some_name">node[@name='n1']/node[@name='n2']</xsl:variable> > > > > > Ainsi parlait Dmitri Ilyin : > > > Hi *, > > > > > > > > > how can i build expression "select" in <xsl:value-of select=""/> > > > dynamicaly, using xsl:variable > > > for example: > > > > > > <xsl:variable name="some_name">node1/node2</xsl:variable> > > > <xsl:value-of select="/node0/$some_name/node_n"/> > > <xsl:value-of select="/node0/*[name()=$some_name]/node_n"/> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format