This happens because the serializer takes a sequence of strings and combines them into a single text node using a single space as the separator. This behaviour is defined in section 2 of the serialization spec. The answer is to use string-join to concatenate the rows without separation:
for $row in ("_1_" , "_2_" , "_3_")
, "")
Michael Kay

From: [] On Behalf Of Cecil New
Sent: 01 February 2008 16:50
Subject: [saxon] text output method

I am creating a CSV file from a collection of xml documents using the text output method.  The second and following lines have a blank at the beginning.  I cannot figure out how to suppress it.  The query below reproduces the problem in the small.

declare option saxon:output "method=text";
declare option saxon:output "indent=no";
declare variable  $FS := ',';
declare variable  $RS := '
declare function local:sequence-to-csv($seq) as xs:string
for $row in ("_1_" , "_2_" , "_3_")

Here is the output where you can see the leading blank.  Thanks for any advice!

>java %CP% net.sf.saxon.Query -t xqtest.xq
Saxon from Saxonica
Java version 1.5.0_11
Analyzing query from xqtest.xq
Analysis time: 156 milliseconds
Execution time: 16 milliseconds