The following picture shows a neural network that will properly compute the
XOR function. The hidden layer (middle) of the network is implemented
with two feature detectors (units that turn on when the feature they
are responsible for detecting is present in the input). The detector for
"two ones in the input" inhibits the output node, whereas the detector
for "any ones in the input" stimulates the output node. When both are
active, the output node is not.
The following picture enumerates the four possible input values for the
network, and shows the resulting patterns of activation, where the
red nodes are active (output=1) and the blue nodes are inactive (output=0).
The important thing to realize here is that the middle layer transforms the input from something non-computable to something computable by extracting features.