Hi,

I think you'll want to add a VerifyPath attribute to the XmlConfig element
that creates the 'add' element so that it doesn't pick up the existing
element called 'add'.  It will need to be something like
"//configuration/location/system.webServer/modules/add[[]@name='Blah,
Blah.2.2013'[]]", which will look for an element called add with an
attribute called name with that value (don't forget this is a formatted
value, hence the escaping around the square brackets).

I think you'll then want to have the XmlConfig element that creates the
'name' attribute, to be a child of the XmlConfig element that creates the
'add' element, so that the 'name' attribute gets applied to the 'add'
element you just created.  I think you can then remove the ElementPath
attribute for the child XmlConfig element.

There are now two cases: either <add name="Blah..."... will already exist,
in which case it won't be created by your installer, or it will not exist
and it will be created by your installer.  If you only want the 'type'
attribute to be set when the element is actually created, then you'll need
to put the XmlConfig element that creates the 'type' attribute as a child
of the XmlConfig element that creates the 'add' element (like the XmlConfig
element that creates the 'name' attribute).

If you want the 'type' attribute to the set regardless of whether your
installer actually created the element, then you'll need to change the
ElementPath attribute to an XPath expression that only picks up the add
element you want to modify:
"//configuration/location/system.webServer/modules/add[[]@name='Blah,
Blah.2.2013'[]]".

I haven't actually tried this, YMMV with some of the parameter values, but
hopefully it gives you some idea of where to look next.

Nicholas


On 21 August 2014 00:34, Steve-Ogilvie <steven.ogil...@titus.com> wrote:

> Okay I have it "working"...
>
> the only problem is that it is replacing the first <add element which I
> don't want, I want it to be a new &lt;add element underneath the first...
>
> &lt;util:XmlConfig
>           Id=&quot;XmlWebConfigAddCreate&quot;
>           File=&quot;[DIRECTORY_PATH_CLIENT]Web.Config&quot;
>           Action=&quot;create&quot;
>           Node=&quot;element&quot;
>
> ElementPath=&quot;//configuration/location/system.webServer/modules&quot;
>           Name=&quot;add&quot;
>           On=&quot;install&quot;
>           Sequence=&quot;1&quot;/>
>
>         <util:XmlConfig
>           Id="XmlWebConfigAddType"
>           File="[DIRECTORY_PATH_CLIENT]Web.Config"
>           Action="create"
>           Node="value"
>
> ElementPath="//configuration/location/system.webServer/modules/add"
>           Name="type"
>           Value="Blah, Blah.2.2013"
>           On="install"
>           Sequence="2"/>
>
>         <util:XmlConfig
>           Id="XmlConfigAddName"
>           File="[DIRECTORY_PATH_CLIENT]Web.Config"
>           Action="create"
>           Node="value"
>
> ElementPath="//configuration/location/system.webServer/modules/add"
>           Name="name"
>           Value="AppCacheModule"
>           On="install"
>           Sequence="3"/>
>
>
>
> --
> View this message in context:
> http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/trying-to-add-XML-element-to-a-web-config-file-tp7596447p7596448.html
> Sent from the wix-users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to