SAXON: ElementCopier, \n needed?

Subject: SAXON: ElementCopier, \n needed?
From: Zsolt Czinkos <czinkos@xxxxxxxxxxxxx>
Date: Mon, 16 Aug 1999 18:33:57 +0000
Hello all,

A few days ago I wrote about a problem I ran into while I was using
SAXON to split and transform2HTML XML files. The problem was:

The input could be let's say:

<text>Bla bla bla <name>J. Smith</name>, blab bla blablablabla.</text>

I used the SAXON 4.5 API and wrote a small program to split bigger
files. The default element handler was ElementCopier. This handler puts
a \n after all endElement. So the result is:

<text>Bla bla bla <name>J. Smith</name>
, blab bla blablablabla.</text>

The problem is that the \n is shown in browsers as space, so when
displaying as HTML with a servlet:

Bla bla bla J. Smith , blab bla blablablabla.
                   ^^^^^


My question is: Is that \n really needed? 


The part of com.icl.saxon.handlers.ElementCopier which I've mentioned:

...
public void endElement( ElementInfo e, Context context ) throws
SAXException
{
    Outputter out = context.getOutputter();
    out.write( "</" );
    out.write(e.getName());
    out.write( ">\n" );
}
...


Again: Is it really needed? Probably there's something in the background
but I don't know what.


Thank you very much,

Zsolt Czinkos


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread