XML Node Variables?

So I have a ton of loops that look into different levels of nodes in my XML database. Here is an example:


var db:XML;

...*loading the database code...*

for each(var option:XML in db.team.rep.number.*) {
    *...lots of code here...*
}

My question is… is it possible to take the node level and put it into a variable?

Something like this:


var db:XML;
var nodeLevel:* = db.team.rep.number.*;

...*loading the database code...*

for each(var option:XML in nodeLevel) {
    *...lots of code here...*
}

nodeLevel = db.team.*;

for each(var option:XML in nodeLevel) {
     *...lots of code here...*
 }

Does my question make sense?