View Single Post
  #2 (permalink)  
Old May 7th, 2008, 04:57 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Although saxon:evaluate allows you to construct XPath expressions dynamically, there is no equivalent allowing you to construct match patterns dynamically.

But your example of Parent/$ElementName can be achieved using

Parent/*[name()=$ElementName]

or perhaps

Parent/*[saxon-evaluate($path)]

However, performance is likely to be awful. You may be better off generating an XSLT stylesheet dynamically and then executing it - I've done that successfully for applications like this.


Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote