Jump to content

How To Remove Blank Lines


Krishn60

Recommended Posts

I have an output from XML to plain Text. But in the result output, I am getting blank lines. Can anybody help me on how to remove them. Here is the sample of the output.----------------------------------------------RLO|^~\&||||||||7|PPBB|||01-01-79Z2R||||XNE||MASS DISAPPEARED WHEN PUNCTURED BY NEEDLE.|RLO|^~\&||||||||7|PPBB||98-98-98Z2R||||RLO|^~\&||||||||7|PPBB|||65-43-21Z2R||||RLO|^~\&||||||||7|PPBB|||34-34-34Z2R||||RLO|^~\&||||||||7|PPBB|||34-34-34Z2R||||-------------------------

Link to comment
Share on other sites

Sorry, I am very new to XSLT. Are you asking for the version. If so, it is 1.0
Um... no. I'm asking about the actual stylesheet you're using. You know... the file with <xsl:...> stuff in it? That file's contents. What is it?
Link to comment
Share on other sites

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text" indent="no" xml:space="default" /> <xsl:variable name="Cartt" select="document('Cartoon')/Recommendations/Recommendation"></xsl:variable> <xsl:template match="Design"><xsl:apply-templates/></xsl:template> <xsl:template match="DesignData"> RLO|^~\&|||||||||7|P PBB||<xsl:value-of select="@BRDD"/> Z2R|1||<xsl:value-of select="BBNumb"/>|||||||||||||||||||||"F"| </xsl:template> <xsl:template match="BuildinComment"> <xsl:for-each select="."> XNE||<xsl:value-of select="@Comment"/>| </xsl:for-each> </xsl:template> <xsl:template match="DocDesignFindings"> <xsl:for-each select="."> BBRK5|<xsl:value-of select="../Veripath/@PathNumEXT"/>|<xsl:value-of select="../Solvent/Character/@RecNumEXT"/ </xsl:for-each> </xsl:template> </xsl:stylesheet>

Link to comment
Share on other sites

Try to add

<xsl:template match="text()" />

at the bottom (before </xsl:stylesheet>) and see how that goes.If that doesn't work out, instead place this at the top (after <xsl:stylesheet>):

<xsl:strip-space elements="*" />

Link to comment
Share on other sites

Great. That works closer to my need. But I still need to remove those spaces. This is what I am getting when I did both the options individually. I still get one line space. I don't need any line space.RLO|^~\&||||||||7|PPBB|||01-01-79Z2R||||XNE||MASS DISAPPEARED WHEN PUNCTURED BY NEEDLE.|RLO|^~\&||||||||7|PPBB||98-98-98Z2R||||RLO|^~\&||||||||7|PPBB|||65-43-21Z2R||||RLO|^~\&||||||||7|PPBB|||34-34-34Z2R||||RLO|^~\&||||||||7|PPBB|||34-34-34Z2R||||

Link to comment
Share on other sites

Remove the spaces in the rest of your templates. Something like this for example:

<xsl:template match="DesignData">RLO|^~\&|||||||||7|PPBB||<xsl:value-of select="@BRDD"/>Z2R|1||<xsl:value-of select="BBNumb"/>|||||||||||||||||||||"F"|</xsl:template><xsl:template match="BuildinComment"><xsl:for-each select=".">XNE||<xsl:value-of select="@Comment"/>| </xsl:for-each></xsl:template><xsl:template match="DocDesignFindings"><xsl:for-each select=".">BBRK5|<xsl:value-of select="../Veripath/@PathNumEXT"/>|<xsl:value-of select="../Solvent/Character/@RecNumEXT"/</xsl:for-each></xsl:template>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...