DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=34025>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=34025 Summary: i18n transformer does not work when <i18n:text> tags are added via XSL Product: Cocoon 2 Version: Current SVN 2.2 Platform: Macintosh OS/Version: Mac OS X 10.3 Status: NEW Severity: normal Priority: P2 Component: blocks AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] 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! -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
