cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COCOON-1474) i18n transformer does not work when <i18n:text> tags are added via XSL
Date Tue, 25 Oct 2005 00:40:55 GMT
     [ http://issues.apache.org/jira/browse/COCOON-1474?page=all ]

Ralph Goers updated COCOON-1474:
--------------------------------

    Bugzilla Id:   (was: 34025)
      Component: * Cocoon Core
                     (was: Blocks: (Undefined))
    Description: 
I have reproduced this in both Cocoon 2.1.5 and 2.2.0-dev. If <i18n:text> tags
are included in the initial file of a pipeline, the i18n transformer works
great. But if they are added via an XSL transformation, the i18n transfomer no
longer works. In this case, when the <i18n:text> tags are added via an XSL
transform, the logs are recording unbalanced SAX events, and the end output is
not well formed XML. I can reproduce this behavior with <i18n:text> and
<i18n:translate> tags. Passing i18n attributes works fine.

An example of the unbalanced SAX events are that when the i18nTransformer is
processing the <i18n:text> elements, the SAX events look like this in the log:

[startElement] uri=,local=i18n:text,raw=i18n:text
[characters] MPT
[endElement] uri=http://apache.org/cocoon/i18n/2.1,local=text,raw=i18n:text

I'm not a SAX expert, but all the other SAX events in my log have the same thing
for startElement and endElement. Further, when it outputs, it looks like this:
<div><i18n:text>MPT</div>
This is not well-formed XML. The i18nTransformer has removed the second
<i18n:text> tag, but not the first, and of course it hasn't translated anything
either.

Here is a test case, so you can reproduce this:

The pipelines:

<!-- this one works fine -->
<map:pipeline>
<map:match pattern="simple.html">
<map:generate src="bugtest/simple.xml" label="record" />
<map:transform type="i18n">
<map:parameter name="locale" value="en"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:pipeline>

<!-- This also works fine -->
<map:pipeline>
<map:match pattern="simple_with_xsl.html">
<map:generate src="bugtest/simple.xml" label="record" />
<map:transform type="xslt" src="bugtest/bugtest.xsl" label="basiccontent"/>
<map:transform type="i18n">
<map:parameter name="locale" value="en"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:pipeline>

<!-- This one works for the titletext, but not for the i18n text in the body.
The <i18n:text> tags were included in simple2.xml for the titletext, but they
were included in bugtest2.xsl for the body text -->
<map:pipeline>
<map:match pattern="simple_xsl_adds_i18n.html">
<map:generate src="bugtest/simple2.xml" label="record" />
<map:transform type="xslt" src="bugtest/bugtest2.xsl" label="basiccontent"/>
<map:transform type="i18n">
<map:parameter name="locale" value="en"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:pipeline>

Files:

simple.xml:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<head>
  <title>
    <i18n:text>titletext</i18n:text>
  </title>
</head>
<body>
    <div class="test">
      <i18n:text>MPT</i18n:text>
    </div>
  </body>
</html>

simple2.xml
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<head>
  <title>
    <i18n:text>titletext</i18n:text>
  </title>
</head>
<body>
    <div class="test">
      MPT
    </div>
  </body>
</html>

bugtest.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:dir="http://apache.org/cocoon/directory/2.0" exclude-result-prefixes="dir">
<xsl:output method='html' indent='yes'/>

<!-- Match the root element -->
<xsl:template match="/">

<html>
<xsl:copy-of select="//head"/>
<body>
        <xsl:copy-of select="/html/body/div"/>
</body>
</html>
</xsl:template>

<xsl:template match="node()|@*">
</xsl:template>

<xsl:template match="/html/body/div">
<div>
        <xsl:value-of select="."/>
</div>
</xsl:template>

</xsl:stylesheet>

bugtest2.xsl:
<?xml version="1.0"?><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:dir="http://apache.org/cocoon/directory/2.0" exclude-result-prefixes="dir">
<xsl:output method='html' indent='yes'/>

<!-- Match the root element -->
<xsl:template match="/">

<html>
<xsl:copy-of select="//head"/>
<body>
        <xsl:apply-templates select="/html/body/div"/>
</body>
</html>
</xsl:template>

<xsl:template match="node()|@*">
</xsl:template>

<xsl:template match="/html/body/div">
<div>
        <i18n:text>
        <xsl:value-of select="."/>
        </i18n:text>
</div>
</xsl:template>
</xsl:stylesheet>

Am I missing something? I can reproduce this in many places, but I've tried to
boil it down to the simplest case I can. Thanks in advance for any advice!

  was:
I have reproduced this in both Cocoon 2.1.5 and 2.2.0-dev. If <i18n:text> tags
are included in the initial file of a pipeline, the i18n transformer works
great. But if they are added via an XSL transformation, the i18n transfomer no
longer works. In this case, when the <i18n:text> tags are added via an XSL
transform, the logs are recording unbalanced SAX events, and the end output is
not well formed XML. I can reproduce this behavior with <i18n:text> and
<i18n:translate> tags. Passing i18n attributes works fine.

An example of the unbalanced SAX events are that when the i18nTransformer is
processing the <i18n:text> elements, the SAX events look like this in the log:

[startElement] uri=,local=i18n:text,raw=i18n:text
[characters] MPT
[endElement] uri=http://apache.org/cocoon/i18n/2.1,local=text,raw=i18n:text

I'm not a SAX expert, but all the other SAX events in my log have the same thing
for startElement and endElement. Further, when it outputs, it looks like this:
<div><i18n:text>MPT</div>
This is not well-formed XML. The i18nTransformer has removed the second
<i18n:text> tag, but not the first, and of course it hasn't translated anything
either.

Here is a test case, so you can reproduce this:

The pipelines:

<!-- this one works fine -->
<map:pipeline>
<map:match pattern="simple.html">
<map:generate src="bugtest/simple.xml" label="record" />
<map:transform type="i18n">
<map:parameter name="locale" value="en"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:pipeline>

<!-- This also works fine -->
<map:pipeline>
<map:match pattern="simple_with_xsl.html">
<map:generate src="bugtest/simple.xml" label="record" />
<map:transform type="xslt" src="bugtest/bugtest.xsl" label="basiccontent"/>
<map:transform type="i18n">
<map:parameter name="locale" value="en"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:pipeline>

<!-- This one works for the titletext, but not for the i18n text in the body.
The <i18n:text> tags were included in simple2.xml for the titletext, but they
were included in bugtest2.xsl for the body text -->
<map:pipeline>
<map:match pattern="simple_xsl_adds_i18n.html">
<map:generate src="bugtest/simple2.xml" label="record" />
<map:transform type="xslt" src="bugtest/bugtest2.xsl" label="basiccontent"/>
<map:transform type="i18n">
<map:parameter name="locale" value="en"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:pipeline>

Files:

simple.xml:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<head>
  <title>
    <i18n:text>titletext</i18n:text>
  </title>
</head>
<body>
    <div class="test">
      <i18n:text>MPT</i18n:text>
    </div>
  </body>
</html>

simple2.xml
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<head>
  <title>
    <i18n:text>titletext</i18n:text>
  </title>
</head>
<body>
    <div class="test">
      MPT
    </div>
  </body>
</html>

bugtest.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:dir="http://apache.org/cocoon/directory/2.0" exclude-result-prefixes="dir">
<xsl:output method='html' indent='yes'/>

<!-- Match the root element -->
<xsl:template match="/">

<html>
<xsl:copy-of select="//head"/>
<body>
        <xsl:copy-of select="/html/body/div"/>
</body>
</html>
</xsl:template>

<xsl:template match="node()|@*">
</xsl:template>

<xsl:template match="/html/body/div">
<div>
        <xsl:value-of select="."/>
</div>
</xsl:template>

</xsl:stylesheet>

bugtest2.xsl:
<?xml version="1.0"?><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:dir="http://apache.org/cocoon/directory/2.0" exclude-result-prefixes="dir">
<xsl:output method='html' indent='yes'/>

<!-- Match the root element -->
<xsl:template match="/">

<html>
<xsl:copy-of select="//head"/>
<body>
        <xsl:apply-templates select="/html/body/div"/>
</body>
</html>
</xsl:template>

<xsl:template match="node()|@*">
</xsl:template>

<xsl:template match="/html/body/div">
<div>
        <i18n:text>
        <xsl:value-of select="."/>
        </i18n:text>
</div>
</xsl:template>
</xsl:stylesheet>

Am I missing something? I can reproduce this in many places, but I've tried to
boil it down to the simplest case I can. Thanks in advance for any advice!


> i18n transformer does not work when <i18n:text> tags are added via XSL
> ----------------------------------------------------------------------
>
>          Key: COCOON-1474
>          URL: http://issues.apache.org/jira/browse/COCOON-1474
>      Project: Cocoon
>         Type: Bug
>   Components: * Cocoon Core
>     Versions: 2.2-dev (Current SVN)
>  Environment: Operating System: Mac OS X 10.3
> Platform: Macintosh
>     Reporter: Bess Sadler
>     Assignee: Cocoon Developers Team

>
> I have reproduced this in both Cocoon 2.1.5 and 2.2.0-dev. If <i18n:text> tags
> are included in the initial file of a pipeline, the i18n transformer works
> great. But if they are added via an XSL transformation, the i18n transfomer no
> longer works. In this case, when the <i18n:text> tags are added via an XSL
> transform, the logs are recording unbalanced SAX events, and the end output is
> not well formed XML. I can reproduce this behavior with <i18n:text> and
> <i18n:translate> tags. Passing i18n attributes works fine.
> An example of the unbalanced SAX events are that when the i18nTransformer is
> processing the <i18n:text> elements, the SAX events look like this in the log:
> [startElement] uri=,local=i18n:text,raw=i18n:text
> [characters] MPT
> [endElement] uri=http://apache.org/cocoon/i18n/2.1,local=text,raw=i18n:text
> I'm not a SAX expert, but all the other SAX events in my log have the same thing
> for startElement and endElement. Further, when it outputs, it looks like this:
> <div><i18n:text>MPT</div>
> This is not well-formed XML. The i18nTransformer has removed the second
> <i18n:text> tag, but not the first, and of course it hasn't translated anything
> either.
> Here is a test case, so you can reproduce this:
> The pipelines:
> <!-- this one works fine -->
> <map:pipeline>
> <map:match pattern="simple.html">
> <map:generate src="bugtest/simple.xml" label="record" />
> <map:transform type="i18n">
> <map:parameter name="locale" value="en"/>
> </map:transform>
> <map:serialize type="html"/>
> </map:match>
> </map:pipeline>
> <!-- This also works fine -->
> <map:pipeline>
> <map:match pattern="simple_with_xsl.html">
> <map:generate src="bugtest/simple.xml" label="record" />
> <map:transform type="xslt" src="bugtest/bugtest.xsl" label="basiccontent"/>
> <map:transform type="i18n">
> <map:parameter name="locale" value="en"/>
> </map:transform>
> <map:serialize type="html"/>
> </map:match>
> </map:pipeline>
> <!-- This one works for the titletext, but not for the i18n text in the body.
> The <i18n:text> tags were included in simple2.xml for the titletext, but they
> were included in bugtest2.xsl for the body text -->
> <map:pipeline>
> <map:match pattern="simple_xsl_adds_i18n.html">
> <map:generate src="bugtest/simple2.xml" label="record" />
> <map:transform type="xslt" src="bugtest/bugtest2.xsl" label="basiccontent"/>
> <map:transform type="i18n">
> <map:parameter name="locale" value="en"/>
> </map:transform>
> <map:serialize type="html"/>
> </map:match>
> </map:pipeline>
> Files:
> simple.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <html xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
> <head>
>   <title>
>     <i18n:text>titletext</i18n:text>
>   </title>
> </head>
> <body>
>     <div class="test">
>       <i18n:text>MPT</i18n:text>
>     </div>
>   </body>
> </html>
> simple2.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <html xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
> <head>
>   <title>
>     <i18n:text>titletext</i18n:text>
>   </title>
> </head>
> <body>
>     <div class="test">
>       MPT
>     </div>
>   </body>
> </html>
> bugtest.xsl:
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
> xmlns:dir="http://apache.org/cocoon/directory/2.0" exclude-result-prefixes="dir">
> <xsl:output method='html' indent='yes'/>
> <!-- Match the root element -->
> <xsl:template match="/">
> <html>
> <xsl:copy-of select="//head"/>
> <body>
>         <xsl:copy-of select="/html/body/div"/>
> </body>
> </html>
> </xsl:template>
> <xsl:template match="node()|@*">
> </xsl:template>
> <xsl:template match="/html/body/div">
> <div>
>         <xsl:value-of select="."/>
> </div>
> </xsl:template>
> </xsl:stylesheet>
> bugtest2.xsl:
> <?xml version="1.0"?><xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
> xmlns:dir="http://apache.org/cocoon/directory/2.0" exclude-result-prefixes="dir">
> <xsl:output method='html' indent='yes'/>
> <!-- Match the root element -->
> <xsl:template match="/">
> <html>
> <xsl:copy-of select="//head"/>
> <body>
>         <xsl:apply-templates select="/html/body/div"/>
> </body>
> </html>
> </xsl:template>
> <xsl:template match="node()|@*">
> </xsl:template>
> <xsl:template match="/html/body/div">
> <div>
>         <i18n:text>
>         <xsl:value-of select="."/>
>         </i18n:text>
> </div>
> </xsl:template>
> </xsl:stylesheet>
> Am I missing something? I can reproduce this in many places, but I've tried to
> boil it down to the simplest case I can. Thanks in advance for any advice!

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message