While this example wont do much for you, it demonstrates what a foreach loop will do. <?foreach?> loops can simplify authoring in many ways, especially for complex products.

Example:

<?foreach number in 1;2;3 ?>
    <Property Id="Property$(var.number)" Value="value$(var.number) />
<?endforeach ?>

Will result in the following being passed to the compiler:

    <Property Id="Property1" Value="value1 />
    <Property Id="Property2" Value="value2 />
    <Property Id="Property3" Value="value3 />

I want to note as a caveat, It can be very easy to break component rules by changing the contents of a component by simply changing the values you iterate over. I recommend not using foreach loops anywhere near components unless you have really thought it through.  Also, while using the preprocessor can be very handy for minimizing the amount of wix code you need to maintain, it can really confuse some of the tools that are out there that help you generate or maintain your wix source. In general, think about other options before you use the preprocessor as a solution but if you think its your best option, enjoy :)

This was originally posted here and may have additional comments.