You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jon Evans <jo...@misgl.com> on 2003/10/17 16:06:56 UTC

XSLT question

Hi,

Sorry, this is not specifically a Cocoon question, it's more of a 
general XSLT question.

I have an xml file with a list of links, which I've just internationalized:

[...]
<tab>
   <caption><i18n:text i18n:key="resources.text"/></caption>
   <href><i18n:text i18n:key="resources.link"/></href>
</tab>
[...]

I try to transform it into HTML like this:

[...]
<xsl:template match="tab" >
  <li><a  href="{href}"><xsl:copy-of
      select="caption/*|caption/text()"/></a></li>
</xsl:template>
[...]

The step after this in my pipeline applies the i18ns.

Now, it doesn't work, presumably because the intermediate step isn't 
valid xml (it would be <a href="<i18n:text .../>">).

Is there a different way to specify it in the xml or the xsl.  Or am I 
stuck with having an i18n step in the pipeline both before and after 
that particular transform?

Cheers,

Jon


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


Re: XSLT question

Posted by Jon Evans <jo...@misgl.com>.
leo leonid wrote:
> I don't really get what want to to, but probably its the attribute 
> translation you are looking for.
> 
> <snip 
> src="http://cocoon.apache.org/2.1/userdocs/transformers/i18n-
> transformer.html">

Thanks Leo,

That doc covered what I was trying to do.

Cheers,

Jon


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


Re: XSLT question

Posted by leo leonid <te...@leonid.de>.
I don't really get what want to to, but probably its the attribute  
translation you are looking for.

<snip  
src="http://cocoon.apache.org/2.1/userdocs/transformers/i18n- 
transformer.html">

Additionally we can translate attributes. This is very useful for  
HTML-forms since labels of buttons are set via an attribute in HTML. To  
translate attributes of a tag, add an additional attribute named  
'i18n:attr' containing a list of attributes, which should be  
translated, separated by spaces. An example:

<INPUT type="submit" value="Submit" i18n:attr="value"/>

The attribute, which will be translated is 'value'. Parameter  
replacement is not available for attributes at this time.

</snip>


On Oct 17, 2003, at 4:06 PM, Jon Evans wrote:

> Hi,
>
> Sorry, this is not specifically a Cocoon question, it's more of a  
> general XSLT question.
>
> I have an xml file with a list of links, which I've just  
> internationalized:
>
> [...]
> <tab>
>   <caption><i18n:text i18n:key="resources.text"/></caption>
>   <href><i18n:text i18n:key="resources.link"/></href>
> </tab>
> [...]
>
> I try to transform it into HTML like this:
>
> [...]
> <xsl:template match="tab" >
>  <li><a  href="{href}"><xsl:copy-of
>      select="caption/*|caption/text()"/></a></li>
> </xsl:template>
> [...]
>
> The step after this in my pipeline applies the i18ns.
>
> Now, it doesn't work, presumably because the intermediate step isn't  
> valid xml (it would be <a href="<i18n:text .../>">).
>
> Is there a different way to specify it in the xml or the xsl.  Or am I  
> stuck with having an i18n step in the pipeline both before and after  
> that particular transform?
>
> Cheers,
>
> Jon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


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