Search code examples
asp.netweb-config-transform

How do I change the inner text instead of attributes in config transformations?


I've been using config transformations a lot, but I'm struggling with one bit: the changing of "inner text" as opposed to attributes.

As an example, I've got the following in a config file (Sitecore's webforms for marketers if anyone's interested):

<param desc="connection string">Database=sitecore_webforms;Data Source=CHANGEME;user id=CHANGEME;password=CHANGEME;Connect Timeout=30</param>

and I want to change it to the proper connection string. Usually that would be part of an attribute which I can do fine but in this case it's not.

Is this possible using either the "vanilla" transformations or Sayed Ibrahim Hashimi's SlowCheetah?


Solution

  • You need to use the Replace transform. In your case, something like

    <param desc="connection string" xdt:Transform="Replace">new connection string here</param>
    

    You'll need to also add the right xdt:Locator attribute, to select the element.