cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conal Tuohy" <Conal.Tu...@vuw.ac.nz>
Subject RE: dynamic node selection
Date Thu, 24 Jul 2003 02:11:21 GMT
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:adam_flegman@yahoo.com]
> Sent: Thursday, 24 July 2003 1:28 p.m.
> To: users@cocoon.apache.org
> 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: adam_flegman@yahoo.com 
> Email #2: planemad@optusnet.com.au
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message