Re: [xsl] dynamicaly build select expression

Subject: Re: [xsl] dynamicaly build select expression
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Thu, 13 Sep 2001 20:56:39 +0200
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: [xsl] 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


Current Thread