Number of sequnces with given value
You should first build the binary expression tree of the given boolean expression. You can then do a Depth First Search on this tree, and start computing the answers from the leaves to the root (bottom to top), similar to the way you've done in your approach. 

But instead of $S(i)$ denoting the number of assignments of the first $i$ $X$s which evaluate to 0, it will now be $S(u)$ denoting the number of assignments of the $X$s which lie in the subtree of $u$, which evaluate the expression until $u$ to be 0. Here $u$ refers to a node in the tree. Similarly $T(u)$ is defined for evaluation to 1. 

The base case would be when $u$ is a leaf (which would happen when it corresponds to an operand), and both $S(u)$ and $T(u)$ would be equal to 1 in that case. Else, if $u$ is an internal node (which corresponds to an operator), you compute the $S$ and $T$ values by looking at the $S$ and $T$ values of its children, $c_1$ and $c_2$, and applying recursion similar to what you had in your answer: 

If $u$ is an OR node,

$S(u) = S(c_1)  S(c_2)$

$T(u) = S(c_1)  T(c_2) + T(c_1)  S(c_2) + T(c_1)  T(c_2)$

If $u$ is an AND node,

$S(u) = S(c_1)  T(c_2) + T(c_1)  S(c_2) + S(c_1)  S(c_2)$

$T(u) = T(c_1)  T(c_2)$

If $u$ is an XOR node,

$S(u) = S(c_1)  S(c_2) + T(c_1)  T(c_2)$

$T(u) = S(c_1)  T(c_2)  + T(c_1)  S(c_2)$

And the final answer would be $S(\mathit{root})$ and $T(\mathit{root})$.