You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by falcorn <pi...@interia.pl> on 2006/12/04 11:43:39 UTC

i18nTransformer problems with static pages

Hi. I have something like this at sitemap.
<map:transformer name="i18n" logger="sitemap.transformer.i18n"
src="org.apache.cocoon.transformation.I18nTransformer">
	        <catalogues default="messages">
	          <catalogue id="messages" name="messages"
location="translations"/>
	        </catalogues>
	<cache-at-startup>false</cache-at-startup>
</map:transformer>

....
 and next

<map:match pattern="index.html">
	<map:generate src="static/index.html"/>
	<map:transform type="i18n">
	   	<map:parameter name="locale" value="{../locale}"/>
	 </map:transform>	   		
	 <map:serialize type="html"/>
</map:match>

and in index.html:
<?xml version='1.0'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:i18n="http://apache.org/cocoon/i18n/2.1" i18n:attr="language"
language="language">
  <head>
    <title>Rechnungs Archiv</title>
    <meta content="no-cache" http-equiv="pragma" />
	<meta content="0" http-equiv="expires" />
	<script type="text/javascript" src="prototype.js" />
	<script type="text/javascript" src="window.js" />
	<script type="text/javascript" src="popup_window.js"></script>
	<script type="text/javascript" src="js.js"></script>
	<script type="text/javascript" src="invoicesSearch.js"></script>
	<script type="text/javascript" src="invoicesPrinting.js"></script>
	<style type="text/css" media="all">@import "invoices.css"; @import
"alert.css";</style>
  </head>
  <body onload="getContents('portal');">
    <div id="header">
       header_logo_como.jpg 
      <span
onclick="getContents('portal');"><i18n:text>Portal.portal</i18n:text></span>
      <span
onclick="getContents('/invoices/logout');"><i18n:text>Portal.logout</i18n:text></span>
    </div>
    <div id="title">Archiv</div>
    <div id="contents">
	    
    </div>
  </body>
</html>

It works, but not at all. There is strange output:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1" language="language">
  <head>
    <title>Rechnungs Archiv</title>
    <meta content="no-cache" http-equiv="pragma"/>
	<meta content="0" http-equiv="expires"/>
	<script type="text/javascript" src="prototype.js" xml:space="preserve"/>
	<script type="text/javascript" src="window.js" xml:space="preserve"/>
	<script type="text/javascript" src="popup_window.js" xml:space="preserve"/>
	<script type="text/javascript" src="js.js" xml:space="preserve"/>
	<script type="text/javascript" src="invoicesSearch.js"
xml:space="preserve"/>
	<script type="text/javascript" src="invoicesPrinting.js"
xml:space="preserve"/>
	<style type="text/css" media="all" xml:space="preserve">@import
"invoices.css"; @import "alert.css";</style>
  </head>
  <body onload="getContents('portal');">
    <div id="header">
       header_logo_como.jpg 
      <span onclick="getContents('portal');">Portal</span>
      <span onclick="getContents('/invoices/logout');">Logout</span>
    </div>
    <div id="title">Archiv</div>
    <div id="contents">
	    
    </div>
  </body>
</html>

There are strange xml:space tag.
And in MsWord this page is not visible.
What i've done wrong?
Could You help me?
Greetings Piotr
-- 
View this message in context: http://www.nabble.com/i18nTransformer-problems-with-static-pages-tf2750404.html#a7673784
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


Re: i18nTransformer problems with static pages

Posted by falcorn <pi...@interia.pl>.

What exactly do you mean with this page is not visible in MSWord. What 
happens if you open the page in your browser?

Sorry. It is my fault.
Now it is correct.
I was thinking about IExplorer.
Greetings

-- 
View this message in context: http://www.nabble.com/i18nTransformer-problems-with-static-pages-tf2750404.html#a7675897
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


Re: i18nTransformer problems with static pages

Posted by Jeroen Reijn <j....@hippo.nl>.
> There are strange xml:space tag.
> And in MsWord this page is not visible.

What exactly do you mean with this page is not visible in MSWord. What 
happens if you open the page in your browser?

> What i've done wrong?
> Could You help me?
> Greetings Piotr

Reijn

Re: i18nTransformer problems with static pages

Posted by Jeroen Reijn <j....@hippo.nl>.
Piotr,

It could be a problem with the mime-type.If you're using 
'application/xhtml+xml' IE6 will not handle it correctly. I'm not sure 
about IE7 though.

Reijn

falcorn wrote:
> I'm using IE7.
> But this is much complicated problem, i think.
> When I use this xsl stylesheet to remowe attributes with namespace prefixes,
> it works.
> when I use map:read instead of map:generate it works too(with xmlns:i18x
> attribute).
> Maybe it is problem with serialization? (Does IE work with xhtml mime?)
> Greetings 
> Piotr
> 

Re: i18nTransformer problems with static pages

Posted by falcorn <pi...@interia.pl>.
I'm using IE7.
But this is much complicated problem, i think.
When I use this xsl stylesheet to remowe attributes with namespace prefixes,
it works.
when I use map:read instead of map:generate it works too(with xmlns:i18x
attribute).
Maybe it is problem with serialization? (Does IE work with xhtml mime?)
Greetings 
Piotr

-- 
View this message in context: http://www.nabble.com/i18nTransformer-problems-with-static-pages-tf2750404.html#a7715509
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


Re: i18nTransformer problems with static pages

Posted by Simone Gianni <si...@apache.org>.
Sorry Piotr,
which version of IE are you using? I can see pages containing xmlns
declarations with all IE versions I have here in my office.

Quite commonly the "blank page in IE" is caused by a head like this :

<html>
  <head>
     <title/>
  </head>

IE is intelligent enought to think that the full page is a title. This
happens at least in versions 5.x of IE, and generating such a head is
pretty simple :

<xsl:template ....
  <head>
    <title><xsl:value-of select="somtingwrOnghere"/></title>
  </head>

Are you sure the problem is the attribute? Cause if not we are talking
about a nice feature but absolutely non blocking and by far not a priority.

Simone


falcorn wrote:
> I removed dtd declaration and xml:space attribute has gone;
> But there is declaration of xmlns:i18n at html tag.
> And IE dosen't like this attribute. I get blank page.
> In FF everything is correct, I only get some warrnings from Tidy that there
> is not standard attribute at html tag: xmlns:i18n
> greetings
> Piotr Idzikowski
>   


Re: i18nTransformer problems with static pages

Posted by hepabolu <he...@gmail.com>.
falcorn said the following on 4/12/06 13:47:
> 
> I removed dtd declaration and xml:space attribute has gone;
> But there is declaration of xmlns:i18n at html tag.
> And IE dosen't like this attribute. I get blank page.
> In FF everything is correct, I only get some warrnings from Tidy that there
> is not standard attribute at html tag: xmlns:i18n

You should add an extra stylesheet that removes superfluous namespace 
attributes. This is what I've done:

    <xsl:template match="*">
       <!-- remove element prefix (if any) -->
       <xsl:element name="{local-name()}">
         <!-- process attributes -->
         <xsl:for-each select="@*">
           <!-- remove attribute prefix (if any) -->
           <xsl:attribute name="{local-name()}">
             <xsl:value-of select="."/>
           </xsl:attribute>
         </xsl:for-each>
         <xsl:apply-templates/>
       </xsl:element>
   </xsl:template>

Add a generic catchall template or you end up with nothing:

    <!-- ========================================= -->
    <!-- generic catchall template                 -->
    <!-- ========================================= -->
    <xsl:template match="text()">
       <xsl:copy>
          <xsl:apply-templates select="text()"/>
       </xsl:copy>
    </xsl:template>


HTH

Bye, Helma


Re: i18nTransformer problems with static pages

Posted by falcorn <pi...@interia.pl>.

I removed dtd declaration and xml:space attribute has gone;
But there is declaration of xmlns:i18n at html tag.
And IE dosen't like this attribute. I get blank page.
In FF everything is correct, I only get some warrnings from Tidy that there
is not standard attribute at html tag: xmlns:i18n
greetings
Piotr Idzikowski
-- 
View this message in context: http://www.nabble.com/i18nTransformer-problems-with-static-pages-tf2750404.html#a7675999
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


Re: i18nTransformer problems with static pages

Posted by Jeroen Reijn <j....@hippo.nl>.
Piotr,

this also happens when using Xalan. It seems that by removing the dtd 
declaration the xml:space tags are removed.

Kind regards,

Jeroen Reijn

falcorn wrote:
> I've commented this i18n transform tag. And is the same. 
> So it isn't i18nTransformer problem.
> But where is a problem?
> Can it be because i'm using saxon as default xslt transformer?

RE: i18nTransformer problems with static pages

Posted by falcorn <pi...@interia.pl>.
I've commented this i18n transform tag. And is the same. 
So it isn't i18nTransformer problem.
But where is a problem?
Can it be because i'm using saxon as default xslt transformer?
-- 
View this message in context: http://www.nabble.com/i18nTransformer-problems-with-static-pages-tf2750404.html#a7674721
Sent from the Cocoon - Dev mailing list archive at Nabble.com.