cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: i18n + XSLT transformation
Date Thu, 30 Jan 2003 19:55:52 GMT
Oh, I didn't see that in the original mail. Your elements are wrongly 
nested. <map:transform/> in <map:transform/> is not possible.

<map:match pattern="essai1">
   <map:generate src="documents/participants.xml"/>
   <map:transform src="stylesheets/participantsINT.xsl">
     <map:parameter name="use-request-parameters" value="true"/>
   </map:transform>
   <map:transform type="i18n"/>
   <map:serialize type="html"/>
</map:match>

So it should work. Do you really need the request parameters in XSL? 
Because XSLT is always cached with the passed params, you thwart more or 
less effective caching.

Regards,

Joerg

Cyril Vidal wrote:
> Thanks for your help Joerg!!
> 
> Yes, I found a solution to my problem but I can't really explain it...
> 
> This runs well:
> <map:match pattern="essai1">
> 
> <map:generate src="documents/participants.xml"/>
> 
> <map:transform src="stylesheets/participantsINT.xsl"
> type="xslt-with-parameters"/>
> 
> <map:transform type="i18n">
> 
> </map:transform>
> 
> <map:serialize type="html"/>
> 
> </map:match>
> 
> with the declaration of transformer xslt-with-param as bellow:
> 
> <map:transformer name="xslt-with-parameters"
> src="org.apache.cocoon.transformation.TraxTransformer">
> 
> <use-request-parameters>true</use-request-parameters>
> 
> </map:transformer>
> 
> 
> 
> but this does'nt work:
> 
> <map:match pattern="essai1">
> 
> <map:generate src="documents/participants.xml"/>
> 
> <map:transform src="stylesheets/participantsINT.xsl">
> 
> <map:parameter name="use-request-parameters" value="true"/>
> 
> <map:transform type="i18n">
> 
> </map:transform>
> 
> <map:serialize type="html"/>
> 
> </map:match>
> 
> <map:transform type="i18n">
> 
> </map:transform>
> 
> <map:serialize type="html"/>
> 
> </map:match>
> 
> I thought both syntaxes were valid, aren't they?
> 
> Regards,
> 
> Cyril.
> 
> ----- Original Message -----
> From: "Joerg Heinicke" <joerg.heinicke@gmx.de>
> To: <cocoon-users@xml.apache.org>
> Sent: Thursday, January 30, 2003 8:36 PM
> Subject: Re: i18n + XSLT transformation
> 
> 
> 
>>Hello Cyril,
>>
>>found this message just now (I still have nearly 500 unread Cocoon
>>messages since the weekend). Did you solve the problem? The sitemap
>>looks ok, maybe the namespace declaration in the XSLT is wrong?
>>
>>Joerg
>>
>>Cyril Vidal wrote:
>>
>>>Hi,
>>>
>>>Just to go more deeply into Cocoon's comprehension, I've yesterday built
> 
> a
> 
>>>little example with the load of two differents stylesheets
>>>(participantsFR.xsl and participantsEN.xsl) depending of the value of a
>>>parameter passed in HTTP Request, and with the help of this
> 
> mailing-list,
> 
>>>I've achieved this.
>>>
>>>Now, I would like to perform exactly the same task, but by another way:
> 
> via
> 
>>>the use of i18n Transformer.
>>>
>>>To translate a static xml file, I've no difficult, and the following
> 
> except
> 
>>>of sitemap.xmap, (supposed I've created a catalogue directory named
>>>translation with message_en.xml and message_fr.xml) works well:
>>>
>>><map:match pattern="try_it">
>>>
>>><map:generate src="documents/essai.xml"/>
>>>
>>><map:transform type="i18n">
>>>
>>><map:parameter name="use-request-parameters" value="true"/>
>>>
>>></map:transform>
>>>
>>><map:serialize type="xml"/>
>>>
>>></map:match>
>>>
>>>The following adresses
>>>http://localhost:8080/cocoon/hellococoon/try_it?locale=fr and
>>>http://localhost:8080/cocoon/hellococoon/try_it?locale=en display the
>>>specified translation.
>>>
>>>
>>>
>>>But now, I would like to mix a XSLT transformation with the i18n
>>>Transformation. (I mean, the different
>>>
>>><i18n:text>text to be translated</i18n:text>  appear now in the XSLT
> 
> file
> 
>>>participantsIN.xsl)
>>>
>>>To perform this task, I've tried the following code (overlapping the
> 
> i18n
> 
>>>transformation inside the XSLT transformation...):
>>>
>>><map:match pattern="try_it1">
>>>
>>><map:parameter name="parameters" value="true"/>
>>>
>>><map:generate src="documents/participants.xml"/>
>>>
>>><map:transform src="stylesheets/participantsIN.xsl">
>>>
>>><map:transform type="i18n">
>>>
>>><map:parameter name="use-request-parameters" value="true"/>
>>>
>>></map:transform>
>>>
>>></map:transform>
>>>
>>><map:serialize type="html"/>
>>>
>>></map:match>
>>>
>>>But when I try by example the following adress:
>>>
>>>http://localhost:8080/cocoon/hellococoon/try_it1?locale=en
>>>
>>>I receive no error message but nor is the i18n transformation done:
>>>
>>>I the HTML result, I have all my <i18n:text>text to be
>>>translated</i18n:text> elements, without any effective translation.
>>>
>>>Waht I have to change in sitemap to fix the problem?
>>>
>>>Thanks again for your help,
>>>
>>>Cyril.
>>
>>
>>---------------------------------------------------------------------
>>Please check that your question  has not already been answered in the
>>FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.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/faq/index.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/faq/index.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