<Component Id="CreateStageDir" Guid="XXXXXXXXXXXXX" Directory="CDSStageDir">
<util:XmlConfig Id="UpdateStageDir" Action="create" ElementPath="//FOO.Configuration/directories" File="[BinDir]Foo.config" Name="stage" On="install" Node="value" Value="[CDSStageDir]" />
Will match //FOO.Configuration/directories but will not match //FOO.Configuration[1,2,...]/directories
This is not XPath behavior. The proper XPath behavior would be to iterate over the NodeList that matches the XPath and to do the operation defined on all members of the NodeList. The documentation describes XMLConfig@ElementPath as an XPath, so it should behave accordingly.
Per the v3.6 documentation for XMLConfig/@ElementPath:
The XPath of the parent element being modified. Note that this is a formatted field and therefore, square brackets in the XPath must be escaped. In addition, XPaths allow backslashes to be used to escape characters, so if you intend to include literal backslashes, you must escape them as well by doubling them in this attribute. The string is formatted by MSI first, and the result is consumed as the XPath.