sayedihashimi / slow-cheetah

XML Transforms for app.config and other XML files
Other
242 stars 54 forks source link

Preserve whitespacing in transformed xml #80

Closed ericnewton76 closed 7 years ago

ericnewton76 commented 11 years ago

Is this possible? I now its passing through an inner library, but preserving the whitespace would be nice.

(original web.config)

<node
  attr1="asdf"
  attr2="asdf" />

(transformer)

<node 
  attr1="changethis"
  attr2="changethis2"
  xdt:Transform="Replace" />

(actual output)

<node attr1="changethis" attr2="changethis2" />

(anticipated output)

<node
   attr1="changethis"
   attr2="changethis2" />

I'm hoping that its just specifying PreserveWhitespace somewhere

sayedihashimi commented 11 years ago

This is most likely an issue with XDT itself, but we will take a look before the next update.

EelkoHeuvelmans commented 11 years ago

Thanks for opening this issue on Github. I was not aware that bugs/requests where collected here :) I have also requested a change for this kind of trouble: http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5/view/Discussions#6969

hope to see this fixed in a next release. keep up the good work!

davilimap commented 7 years ago

This type of whitespacing is always removed, even in the native System.Xml reader. As it's stated here and here, the whitespace in an XML tag is irrelevant to most readers. This being the case, XDT (the transformation lib that SC uses) also ignores this whitespace. That being said, whitespace outside of tags is preserved by default. Closing as this is an underlying limitation of the XML API being used.