cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Corey Jewett ...@syntheticplayground.com>
Subject Re: HTML Output Issues
Date Sat, 30 Mar 2002 06:28:32 GMT
Sorry for the long turn around, took an unexpected vacation. :)

Unfortunately I've already tried the no-indent-strip-space-all-elements
solution without success. I tried it again just to be sure and it still
didn't work. Following are snippets from relevant files.

I've truncated the attributes of the tags so line wrapping doesn't
distract from the problem. All comments are also added. In case it
matters I'm using a completely stock cocoon 2.0.1 under Tomcat 4.0.1 on
RedHat 7.1.

My content looks like this:

<document>
    <title><!-- This is the Title --></title>
    <content>
	<!-- Some XHTML content -->
    </content>
</document>


My XSL looks like this:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xml:space="preserve">
<xsl:output indent="no" />
<xsl:strip-space elements="*" />

  <xsl:template match="document">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title><xsl:value-of select="title"/></title>
<!-- layout tables which are also improperly spacing -->

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

<!-- Then some popup menus, also improperly spacing -->
    <div id="aboutnav" class="where">
      <table border="0" cellpadding="0" cellspacing="0" width="116">
        <tr>
          <td><a href="..."><img name="mission" src="..."/></a></td>
        </tr>
        <tr>
          <td><a href="..."><img name="mission" src="..."/></a></td>
        </tr>

	...

      </table>
    </div>
  </body>
</html>
  </xsl:template>
</xsl:stylesheet>


The output like this:

    <div class="where" id="aboutnav">
      <table width="116" cellspacing="0" cellpadding="0" border="0">
        <tr>
          <td>
<a href="with attribs reordered">
<img src="also with attribs reordered"/>
</a>
</td>
        </tr>
...


Finally if it is relevant I'm using a nested sitemap:

<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <!-- =========================== Components ================== -->
    <map:components>
	<map:generators default="file"/>
	<map:transformers default="xslt"/>
	<map:readers default="resource"/>
	<map:serializers default="html"/>
	<map:selectors default="browser"/>
	<map:matchers default="wildcard"/>
    </map:components>

    <!-- =========================== Pipelines =================== -->
    <map:pipelines>
        <map:pipeline>
            <map:match pattern="**/*.jcp" type="wildcard">
                <map:generate type="file" src="{1}/{2}.jcp"/>
                <map:transform type="xslt" src="{1}/template.jtp"/>
                <map:serialize/>
            </map:match>
        </map:pipeline>

<!-- There's another pipeline for unparsed content (images, etc), and
another for unavailable content right here. -->

    </map:pipelines>
</map:sitemap>


Basically if the spacing in the stylesheet could be maintained into the
output then it would work fine, but instead extra line returns are being
placed at the end of every tag. Any way to stop this short of modifying
the code in cocoon?

Thanks,
Corey



On Tue, 2002-03-26 at 02:52, Bert Van Kets wrote:
> I had the same problem.  Adding
> <xsl:output indent="no" />
> <xsl:strip-space elements="*" />
> right under the root node solved the problem.  Every image sticks correctly 
> to the previous one in the browser.  All the tags follow one another.  It's 
> also a very good way to compress the HTML output.  There's one drawback 
> though: all the leading spaces are stripped too.  So if you are relying on 
> a space to separate text from an image you have to add a space using the 
> xsl:text element.
> Make sure you don't have any JavaScript in your page or the lines from your 
> code will be placed on 1 line too.  Use external javascript files and 
> everything is solved.
> Bert
> 
> 
> At 01:49 26/03/2002 -0800, you wrote:
> >Rookie cocoon user. Asked this question about a week ago and got no
> >answer, trying to rephrase it.
> >
> >I have very simple XML documents. I'm using a simple XSL to insert
> >content (from the XML) into an XHTML skin. Works well except the
> >resulting HTML is modified which breaks browser display compatibility
> >(menu layout spacing is drastically, and incorrectly, changed). Example:
> >
> >Input:
> >     <tr><td><a href="somwhere.htm"><img src="image.gif"></a></td></tr>
> >
> >
> >Output:
> ><tr>
> ><td>
> ><a href="somwhere.htm">
> ><img src="image.gif"/>
> ></a>
> ></td>
> ></tr>
> >
> >
> >Is there some way to keep the XHTML that is embedded in my XSL from
> >being reformatted this way. I've tried messing with a variety of XML and
> >XSL whitespace control techniques, but none with the desired result.
> >
> >Any help would be appreciated.
> >
> >Corey
> >
> >
> >---------------------------------------------------------------------
> >Please check that your question has not already been answered in the
> >FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> >To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> >For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> 



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message