NB to avoid problems namespaces you might want to use the local-name() function instead of the name() function.
e.g. if $parent="foo" and $child="bar" then: /*[local-name()=$parent][*[local-name()=$child]] should return all nodes which match the xpath "/foo/bar" Cheers Con > -----Original Message----- > From: Adam Flegman [mailto:[EMAIL PROTECTED] > Sent: Thursday, 24 July 2003 1:28 p.m. > To: [EMAIL PROTECTED] > Subject: Re: dynamic node selection > > > > Have you tried using name() function like: > > > > <xsl:apply-templates > > select="/*[name()=$parentNode]/*[name()=$childNode]"/> > > > > However, as far as I know name() function is there for > > "emergency" cases, rather than normal usage. > > > > If you know what the nodes might be, you might want to > > use several stylesheets and pick the right stylesheet > > dynamically. > > Hi Alex, > > In some cases I actually had the node corresponding to the > parent and tried > using the name() function to match the $childNode portion but > it still didn't > work. > > select="$parentNode/*[name()=$childNode]" > > ($parentNode is an actual node, $childNode was the name of > the desired target > node below the parent). > > > I was hoping to use this approach to help cleanup/refactor > some verbose xslt > code I have inheirited. Its not really a critical problem as > the existing code > is functionally correct, I was just trying to tidy it up a bit. > > > > Ad. > > > ===== > Adam Flegman - Senior Software Engineer > > Mobile: (0414) 375 735 > Phone: (07) 5547 8530 > Facsimile: (07) 5547 8532 > Email #1: [EMAIL PROTECTED] > Email #2: [EMAIL PROTECTED] > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software > http://sitebuilder.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
