xsl-list
[Top] [All Lists]

RE: newline headaches in text output

2004-06-24 07:06:56
From: Butler Adam [mailto:abutler(_at_)AGRIS(_dot_)com] 

I am currently attempting to generate delimited text files 
from XML source documents using XSL.  When I perform the 
transformation I get extra newlines at the beginning of the 
target document.  I have read through the FAQ and the topic: 
"text output method, and newline problems", while relevant 
didn't provide me with a solution.  I have included a simple 
xml object and a simple xsl sheet.  Any advice would be 
greatly appreciated.

This request is a good example of why people should say what processor
they  used, and how they used it to generate the results.  I tried this
transformation using some half dozen xsl processors, including oldish
versions of saxon, xalan, sablotron, and msxml.  None of these put an
extra line at the start of the output.  I did this in an old version of
XML Cooktop (I use the old version because its user interface is better
than the newer version).

Usually, if you are getting extra lines or whitespace, the first thing
to try is to take out all extra line breaks from the stylesheet. This
makes the stylesheet hard to read but you can usually recover most of
the readability later.

So you could try changing from your original

        <xsl:template match="people">
        <xsl:for-each select="person">

To this

<xsl:template match="people"><xsl:for-each select="person">

Or as a more readable variation, 

<xsl:template match="people"
   ><xsl:for-each select="person">

But based on my results, try another processor instead.

Cheers,

Tom P


<Prev in Thread] Current Thread [Next in Thread>