You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mathias Ochsendorf <ma...@ochsendorf.net> on 2002/09/17 18:25:57 UTC

i18n question

hi together,

I'm looking for a way to substitute/translate
the following statement with i18n-transformations:

<a href="/test">
   <img src="/images/test.svg?label_text={0}&#38;label_color={1}"/>
</a>

to:
<a href="/test">
   <img src="/images/test.svg?label_text=hello&#38;label_color=red"/>
</a>

i18n:attr settings don't work in my case, do they ?
I need a way to prepare the src-attribute with dynamic information.
have someon a glue. can I use in some way xsl:variables or xsl:attributes
??

I'm using the cvs-snapshot from last friday.

greetings,
mathias
-- 
Mathias Ochsendorf
www: www.ochsendorf.net | www.ochsendorf.de
ICQ: 68556900


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: i18n question

Posted by Mathias Ochsendorf <ma...@ochsendorf.net>.
Hi list,

thanks for your help and advices :)


> Sure it will couse a nullpointerexception. First of all you need to to get
> from this snip something like this:
>
> <a href="/test">
>     <img>
>  	<xsl:attribute name="src">
>  			/images/test.svg?label_text=hello&amp;label_color=red
>  	</xsl:attribute>
>     </img>
>  </a>
>
> and than use this stylesheet
>
> See example:
>
> Your sitemap should have:
>
> <map:match pattern="stylesheets/*.xsl">
> 	<map:generate src="stylesheets/{1}.xsl"/>
> 	<map:transform type="i18n"/> <!-- will generate a valid xsl without i18n
> tags, and it will not couse an error anymore -->
> 	<map:serialize type="xml"/>
> </map:match>
>
> <map:match pattern="...">
> 	<map:generate src="<you-source>"/>
> 	<map:transform src="cocoon:/stylesheets/<stylesheet-with-my-snip>.xsl"/> <!--
> use stylesheet generated by previous pipeline -->
> 	<map:serialize/>
> </map:match>

-- 
Mathias Ochsendorf
www: www.ochsendorf.net | www.ochsendorf.de
ICQ: 68556900


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: i18n question

Posted by Ivan Luzyanin <iv...@ProZa.Lviv.UA>.
On Wednesday 18 September 2002 17:09, Mathias Ochsendorf wrote:
> > <a href="/test">
> >    <img>
> > 	<xsl:attribute name="src">
> > 		<i18n:translate>
> > 			<i18n:text>/images/test.svg?label_text={0}&amp;label_color={1}</i18n:t
> >ext> <i18n:param><i18n:text>hello</i18n:text></i18n:param>
> > 			<i18n:param><i18n:text>red</i18n:text></i18n:param>
> > 		</i18n:translate>
> > 	</xsl:attribute>
> >    </img>
> > </a>
>
> unfortunately this approach doesn't work. it causes a
> nullpointerexception:
>
> Original exception :
> org.apache.avalon.excalibur.xml.xslt.XSLTProcessorException: Exception in
> creating Transform Handler
> at
> org.apache.avalon.excalibur.xml.xslt.XSLTProcessorImpl.getTransformerHandle
>rAndValidity(XSLTProcessorImpl.java:287) at
> org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java
>:333)

Sure it will couse a nullpointerexception. First of all you need to to get 
from this snip something like this:

<a href="/test">
    <img>
 	<xsl:attribute name="src">
 			/images/test.svg?label_text=hello&amp;label_color=red
 	</xsl:attribute>
    </img>
 </a>

and than use this stylesheet

See example:

Your sitemap should have:

<map:match pattern="stylesheets/*.xsl">
	<map:generate src="stylesheets/{1}.xsl"/>
	<map:transform type="i18n"/> <!-- will generate a valid xsl without i18n 
tags, and it will not couse an error anymore -->
	<map:serialize type="xml"/>
</map:match>

<map:match pattern="...">
	<map:generate src="<you-source>"/>
	<map:transform src="cocoon:/stylesheets/<stylesheet-with-my-snip>.xsl"/> <!-- 
use stylesheet generated by previous pipeline -->
	<map:serialize/>
</map:match>

Regards!
Ivan Luzyanin.

---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: i18n question

Posted by Mathias Ochsendorf <ma...@ochsendorf.net>.
> <a href="/test">
>    <img>
> 	<xsl:attribute name="src">
> 		<i18n:translate>
> 			<i18n:text>/images/test.svg?label_text={0}&amp;label_color={1}</i18n:text>
> 			<i18n:param><i18n:text>hello</i18n:text></i18n:param>
> 			<i18n:param><i18n:text>red</i18n:text></i18n:param>
> 		</i18n:translate>
> 	</xsl:attribute>
>    </img>
> </a>

unfortunately this approach doesn't work. it causes a
nullpointerexception:

Original exception :
org.apache.avalon.excalibur.xml.xslt.XSLTProcessorException: Exception in
creating Transform Handler
at
org.apache.avalon.excalibur.xml.xslt.XSLTProcessorImpl.getTransformerHandlerAndValidity(XSLTProcessorImpl.java:287)
at
org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:333)

...



Best,
-- 
Mathias


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: i18n question

Posted by Ivan Luzyanin <iv...@ProZa.Lviv.UA>.
On Tuesday 17 September 2002 19:25, Mathias Ochsendorf wrote:
> hi together,
>
> I'm looking for a way to substitute/translate
> the following statement with i18n-transformations:
>
> <a href="/test">
>    <img src="/images/test.svg?label_text={0}&#38;label_color={1}"/>
> </a>
>
> to:
> <a href="/test">
>    <img src="/images/test.svg?label_text=hello&#38;label_color=red"/>
> </a>

Try this way:
<a href="/test">
   <img>
	<xsl:attribute name="src">
		<i18n:translate>
			<i18n:text>/images/test.svg?label_text={0}&amp;label_color={1}</i18n:text>
			<i18n:param><i18n:text>hello</i18n:text></i18n:param>
			<i18n:param><i18n:text>red</i18n:text></i18n:param>
		</i18n:translate>
	</xsl:attribute>
   </img>
</a>

I'm not exactly understand why you need it, but hope it solves you problem.

Regards!
Ivan Luzyanin.




---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>