While porting some xpath-heavy AS2 code to AS3, I ran into problems. E4X (new and improved xml support in AS3) seems to make xpath obsolete. However, all the E4X query examples in the docs use hard-coded literals. I can't use literals because I don't know at code-time what the queries are going to be. My AS2 code creates xpath paths dynamically from variables. What is the E4X equivalent?
After some initial confusion on my part, I now get it. In retrospect, what's below seems obvious -- but that's the way it always is.
Selecting a variable-named node type
Let's work with this xml:
