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="*" />.



kpejrAsked:
Who is Participating?
 
etmendzConnect With a Mentor Commented:
In your XSLT, try to write the code that transforms for <email> in one line. That is for example:

<email><xsl:value-of select="."></email>

Have fun.
0
 
andrewharrisConnect With a Mentor Commented:
Apart from the fact that it is ignoring your strip-space directive you could possibly run a replace on "> </" with "></" it is definately a work around but the best I could think of short term.

Andrew
0
 
kpejrAuthor Commented:
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.

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

    Public Overrides Sub WriteFullEndElement()
        MyBase.WriteEndElement()
    End Sub
0
All Courses

From novice to tech pro — start learning today.