#706 XMLConfig's @ElementPath is actually treated as XPath

v3.x
migrated
nobody
None
2013-08-21
2012-10-09
Nick Hansen
No

<Component Id="CreateStageDir" Guid="XXXXXXXXXXXXX" Directory="CDSStageDir">
<CreateFolder />
<util:XmlConfig Id="UpdateStageDir" Action="create" ElementPath="//FOO.Configuration/directories" File="[BinDir]Foo.config" Name="stage" On="install" Node="value" Value="[CDSStageDir]" />
</Component>

Will match //FOO.Configuration[0]/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.

Discussion

  • Nick Hansen
    Nick Hansen
    2012-10-09

    This was originally filed as a bug report: https://sourceforge.net/p/wix/bugs/3115/

    It was suggested to file it as a feature request instead.

     
  • Rob Mensching
    Rob Mensching
    2013-07-14

    • Group: v3.6 --> v3.x
     
  • Rob Mensching
    Rob Mensching
    2013-08-21

    • Status: open --> migrated