XDT transformation removes wrong entry

Jeroen Heier

I am using this site to test my XDT transformations before using in NuGet. When i have this config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
  </httpModules>
  </system.web>
</configuration>

And use this transform:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.web>
    <httpModules>
      <add name="ErrorLog" xdt:Transform="Remove" />      
    </httpModules>
  </system.web>
</configuration>

The result is this output:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <httpModules>

      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
    </httpModules>
  </system.web>
</configuration>

I do not understand why the entry ApplicationInsightsWebTracking is removed and not ErrorLog. I got the same results when using this transformation in a NuGet package (when removing the package). How to change the transformation in a working one?

har07

You need to explicitly tell XDT to match by name attribute as well, by using xdt:Locator="Match()", otherwise only the element location/path will be considered for matching (that's why the first add element got removed initially) :

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.web>
    <httpModules>
      <add name="ErrorLog" xdt:Locator="Match(name)" xdt:Transform="Remove" />      
    </httpModules>
  </system.web>
</configuration>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

XDT Transform: InsertBefore - Locator Condition is ignored

From Dev

display message on wrong password entry

From Dev

Move XML element using XDT

From Dev

Clearing out xdt element if it has no children

From Dev

difference between specify by reference and transformation name in transformation job entry

From Dev

What is wrong with my Fourier Transformation (Convolution) in MathNet.Numerics? - C#

From Dev

“The procedure entry point… could not be located” in the wrong DLL

From Dev

"Wrong sources.list entry or malformed file" for Chrome while using `apt-get update`

From Dev

main/binary-i386/Package(Wrong sources.list entry or malformed

From Dev

Haskell: Why is this monad transformation wrong?

From Dev

SQL Server getting newest entry returns wrong results. What am I missing?

From Dev

Drag behaviour wrong after UIView transformation

From Dev

Maven jar plugin - Wrong Class-Path entry for SNAPSHOT dependency

From Dev

Splicing array removes wrong node in force-directed graph

From Dev

lock application on wrong password entry (c/c++)

From Dev

Entry Validation going wrong with tkinter

From Dev

C# Dictionary add entry with wrong order

From Dev

java copy-of xsl transformation removes namespace prefix

From Dev

Move XML element using XDT

From Dev

Delphi Alt key + accelerator key plays a "wrong entry" sound

From Dev

Why Windows takes longer time to report a wrong password entry?

From Dev

Remove namespace entry from element, which was added by XSLT during transformation

From Dev

Wrong Transformation Rendering a Simple Square on OpenGL ES 2 (iOS)

From Dev

Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file)

From Dev

MySQL Duplicate entry, but a wrong string

From Dev

System booting all right despite wrong root entry in /etc/fstab

From Dev

Connection Strings/Settings in Azure Portal - is it a xdt:Transform="SetAttributes", a xdt:Transform="Insert" or hybrid?

From Dev

login button entry activity even if the password is wrong , Retrofit 2

From Dev

Script resets data when I entry wrong value

Related Related

  1. 1

    XDT Transform: InsertBefore - Locator Condition is ignored

  2. 2

    display message on wrong password entry

  3. 3

    Move XML element using XDT

  4. 4

    Clearing out xdt element if it has no children

  5. 5

    difference between specify by reference and transformation name in transformation job entry

  6. 6

    What is wrong with my Fourier Transformation (Convolution) in MathNet.Numerics? - C#

  7. 7

    “The procedure entry point… could not be located” in the wrong DLL

  8. 8

    "Wrong sources.list entry or malformed file" for Chrome while using `apt-get update`

  9. 9

    main/binary-i386/Package(Wrong sources.list entry or malformed

  10. 10

    Haskell: Why is this monad transformation wrong?

  11. 11

    SQL Server getting newest entry returns wrong results. What am I missing?

  12. 12

    Drag behaviour wrong after UIView transformation

  13. 13

    Maven jar plugin - Wrong Class-Path entry for SNAPSHOT dependency

  14. 14

    Splicing array removes wrong node in force-directed graph

  15. 15

    lock application on wrong password entry (c/c++)

  16. 16

    Entry Validation going wrong with tkinter

  17. 17

    C# Dictionary add entry with wrong order

  18. 18

    java copy-of xsl transformation removes namespace prefix

  19. 19

    Move XML element using XDT

  20. 20

    Delphi Alt key + accelerator key plays a "wrong entry" sound

  21. 21

    Why Windows takes longer time to report a wrong password entry?

  22. 22

    Remove namespace entry from element, which was added by XSLT during transformation

  23. 23

    Wrong Transformation Rendering a Simple Square on OpenGL ES 2 (iOS)

  24. 24

    Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file)

  25. 25

    MySQL Duplicate entry, but a wrong string

  26. 26

    System booting all right despite wrong root entry in /etc/fstab

  27. 27

    Connection Strings/Settings in Azure Portal - is it a xdt:Transform="SetAttributes", a xdt:Transform="Insert" or hybrid?

  28. 28

    login button entry activity even if the password is wrong , Retrofit 2

  29. 29

    Script resets data when I entry wrong value

HotTag

Archive