Link to home
Start Free TrialLog in
Avatar of kpejr
kpejr

asked on

Get a carriage return in empty elements .net xmltransform

Is there any way around this short of telling the xmlwriter not to indent?
I have a process that send an xml doc to a cust who changes some data and
returns it.  It gets rejected on the resubmit because of the problem below.

I have an xslt trans. I am transforming it with the .net transformation
object when it hits an empty element it reurns something like this.
<email>
  </email>
instead of
<email></email> or <email/>

the .net objects seems to ignore  <xsl:strip-space elements="*" />.



SOLUTION
Avatar of andrewharris
andrewharris

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kpejr
kpejr

ASKER

I tried the replace before, the problem is you would have to parse before you replaced or it replaces the cr after and end tag for a block as well as the ones you want to replace.

I just tried <email><xsl:value-of select="."></email> and it still adds the cr.

Avatar of kpejr

ASKER

Figured it out. You have to inherit the xmltextwriter and override WriteFullEndElement with this:

    Public Overrides Sub WriteFullEndElement()
        MyBase.WriteEndElement()
    End Sub