cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Corey Jewett>
Subject HTML Serialization and newlines
Date Tue, 19 Mar 2002 10:14:40 GMT
I'm using XSL to 'skin' XML content and translate it into XHTML. It
works great as far as the output being valid XHTML and all my tags,
scripts, etc. coming out in the browser source. 

The only problem I'm running into is the insertion of a newline after
every element in my stylesheet. My table elements, specifically TDs and
the content they contain, need to all be one one line. (Note: This
wouldn't be a problem if browser manufacturers could write a parser that
properly ignores newlines, but they don't seem to be able to.) The
reason for this is layout control in DHTML pop-ups. I have no control
over the design, so I'm stuck dealing with whatever evil has already
been done. ;)

Preferably I'd like to preserve the spacing in my XSL sheet (I don't
care about the XML content currently), but I would also be perfectly
happy if the entire document was all on one line, as with the XML
serializer, since that should also fix the problem. BTW The
XMLSerializer changes the content output type to 'text/xml' which
triggers download dialogs so it won't work.

I have searched the archives and all methods described therein (and
duplicated below) seem to have no effect on the output. I am also not
entirely clear on the parsing order (nor all the features of XSL) so if
I'm headed off in the wrong direction or pursuing the impossible I'd
appreciate a hint.

Stripped down version of XSL sheet:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl=""
  <xsl:preserve-space elements="*"/>
  <xsl:output method="html" indent="yes" encoding="iso-8859-1"/>

  <xsl:template match="document">
<html xmlns="">
    <title><xsl:value-of select="title"/></title>


  <body bgcolor="#ffffff" background="../images/header/ns3_bg.gif"
marginheight="0" marginwidth="0" topmargin="0" leftmargin="0"


<xsl:value-of select="content"/>



Potential solutions:
The most promising was: <xsl:preserve-space elements="*"/>. Inversely, I
tried xsl:strip-space elements="*"/> as in:

  <xsl:strip-space elements="*"/>
  <xsl:output method="html" indent="no" encoding="iso-8859-1"/>

which also seemed to have no effect.

I also tried xml:space="preserve", but I believe that's intended more
for my XML source than my stylesheet.

I'm certain cocoon allows better control of the output document, but I'm
at a loss for how to utilize it. Any pointers in the right direction, or
any direction for that matter, would be much appreciated.


Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message