views:

128

answers:

1

I am trying to use XSLT to convert an XML document to a text file and the text of the document looks fine. However, I need to add a carriage return after the end of each line (NOT A CRLF) and I seem to be failing in every attempt. I have tried adding just a CR at the end of the line like this:

 <xsl:text>&#xD;</xsl:text>

I have tried changing my media-type to string, I have tried to add the disable-output-escaping attribute to the text element, but it always adds a CRLF.

This is on a Windows OS and I know that Windows uses CRLF for a new line, but I would have thought you could override that if you said to specifically use only the CR or the LF (e.g. VB.net's VBCR or VBLF). Does anyone know if it is possible to only output a CR with XSLT?

Thanks in advance.

A: 

Typing my next to last sentence caused the answer to occur to me, though I would still be interested in hearing if there are more elegant solutions. Basically I stored the results of the transform in a string in VB, then string replaced the vbcrlf with vbcr before outputing:

    xmlTrans.Load(xsltDocPath) 'load the xslt
    xmlTrans.Transform(xmlDoc.CreateNavigator(), Nothing, sw) xform into a stringWriter
    outString = sw.ToString().Replace(vbCrLf, vbCr) 'replace the crlf with just a cr

    HL7Writer.WriteLine(outString) 'output the results

Again, if anyone has a more elegant XSL based solution, I would interested in hearing it.

Thanks.

dsrekab