cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Lange" <ola...@petit-atelier.ch>
Subject i18n trouble with nested elements in catalog messages
Date Tue, 09 Sep 2003 00:13:18 GMT
Hello all,

Does anybody know if the i18n transformer supports nested elements within
the catalog messages? I examined the tranformer's source code (Cocoon 2.1),
but it is not obvious to me.

If not, would it be possible and make sense to enable support for nested
elements with attributes and namespaces? Or would it not be desirable?

I would like to have short structured text messages (XML fragments) within
the catalog, rather that just plain text messages (character strings).

Let me give an example. I'd like to translate the following <i18n:text>
element:

index.xml

  ...
    <i18n:text>21</i18n:text>
  ...

with the following message:

messages_en.xml:

  <catalogue xml:lang="en"
    xmlns:d="urn:petit-atelier.ch:docmini:v1.1"
    xmlns:xlink="http://www.w3.org/1999/xlink">

    <message key="21">
      <d:p> ...<d:email href="user@domain.ch"/>... </d:p>
      <d:p>...</d:p>
    </message>
  </catalogue>

I tried with the following sitemap:

sitemap.xmap:

    <map:match pattern="*/events/index.html"
      <map:generate src="cocoon:/events/index.xml">
      <map:transform type="i18n">
          <map:parameter name="locale" value="{1}"/>
      </map:transform>
      <map:serialize type="xhtml"/>
    </map:match>

and almost succeeded. When I serialized immediately after the i18n
transformation, it worked well, seemingly at least*: the output contained
the <d:p> ...<d:email href="user@domain.ch"/>... </d:p> <d:p>...</d:p>
structured text.

But when I added some XSLT transformation or any other transformation, I ran
into trouble. The following generates a NPE (Cocoon 2.1/Tomcat 4.1.27/JDK
1.4.1_02/win2k):

sitemap.xmap:

      ...
      <map:transform type="i18n">
          <map:parameter name="locale" value="{1}"/>
      </map:transform>
      <map:transform type="xslt" src="docmini-to-xhtml.xsl"/>
      <map:serialize type="xhtml"/>
    </map:match>

(The docmini-to-xhtml transformation runs fine on the Xalan command-line
with the serialised output of the previous pipeline).

This happens with any transformer (xsl, linkrewriter, log, ...).

Is this happening because the i18n transformer is not intended to support
nested elements?

* A closer inspection with the Log transformer gave me the feeling that the
SAX flow was compromised
(uri=*null*,local=*null*,qname=href,type=CDATA,value=mailto:user@domain.ch)

Olivier


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


Mime
View raw message