Motivating Example:
Suppose that I want to draw the following tree:
root
/ / \ / A B C D
This is easy enough to do by explicitly drawing the two subtrees
as children of the root node and using a child foreach in
each subtree to draw the leaves. For instance:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node {root} [level/.append style={sibling distance=2cm/#1}]
child {
coordinate
child foreach \x in {A,B} {
node {\x}}}
child {
coordinate
child foreach \x in {C,D} {
node {\x}}};
\end{tikzpicture}
\end{document}

However, even in this simple example, a fair amount of code is duplicated across the two subtrees. If the leaves were more complex, code duplication would be an even bigger disadvantage.
An alternate idea for drawing this tree attempts to use nested
child foreach constructs to reduce the code duplication:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (5cm,0) {root} [level/.append style={sibling distance=2cm/#1}]
child foreach \xs in {{A,B}, {C,D}} {
coordinate
child foreach \x in \xs {
node {\x}}};
\end{tikzpicture}
\end{document}
Unfortunately, this code produces the wrong tree structure:

Interestingly, Martin Scharrer's answer to TikZ \foreach loop with macro-defined list suggests that the code should work as is. The only difference that I can see is that that question uses \foreach rather than child foreach.
Problem:
The underlying problem seems to be that \xs is not
expanded before the inner loop is executed. As a result,
TikZ is treating the inner loop as having a range that is a
singleton set, namely \xs (unexpanded). If \xs could be
expanded before the inner loop is executed, then TikZ should
treat the inner loop as having a range that is {A,B} in one
case and {C,D} in the other case.
Question:
How can I expand a macro, such as \xs above, used inside
the range of a foreach loop?
