Below is the xml
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ser="http://xyz.com.zr/l8q/12Q/service/">
    <soapenv:Header>
        <ser:User>
            <!-- comment -->
            <Username/>
            <password/>
        </ser:User>
    </soapenv:Header>
    <soapenv:Body>
        <mainTag>
            <abc>1596056</abc>
            <asd>12434F</asd>
            <def>wert</def>
            <childtag>
                <asdf>1233</asdf>
                <qwe>567</qwe>
            </childtag>
        </mainTag>
    </soapenv:Body>
</soapenv:Envelope>
Below is my XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
    <xsl:template match="mainTag">
        <xsl:result-document href="foo.txt" method="text">
            01|<xsl:value-of select="abc"/>|<xsl:value-of select="asd"/>|<xsl:value-of select="childtag/asdf"/>|
            02|<xsl:value-of select="def"/>|<xsl:value-of select="childtag/asdf"/>|
            03|<xsl:value-of select="def"/>|<xsl:value-of select="childtag/qwe"/>|<xsl:value-of select="childtag/asdf"/>| | 
        </xsl:result-document>
    </xsl:template>
</xsl:stylesheet>
Below is the output generated from above xslt

Below is the text file which contains data from the xslt output

i am stuck with how i can remove the spaces in the file (screen shot mentioned in the above screenshot)
 
    