If one enters a For-Each Select loop, telling it to look for two particular tags, completed by using the loop or function (tag1 | tag2), then if one wishes to have a particular function performed on just one on the tags, say tag1 -- How do you get the context from the For-Each loop -- as the tag1 and tag2 are no longer recognized unless they are nested within each other? So you would need to have <tag1> <tag2></tag2><tag1> to be able to complete a function on tag 2 but then it would also apply it to the outer tag1 as well.

Is there anyway of avoiding this?


    Requires Free Membership to View

It sounds like the function that needs to be performed on tag1 should be separated from the function to be performed on tag2. If there is commonality between the two pieces of code, the code can be factored into separate functions.

Removing the distinction between tag1 and tag2 is what is causing the problem here.


This was first published in February 2002

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.