RE: [xsl] Translate and substring in AVT

Subject: RE: [xsl] Translate and substring in AVT
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 11 Mar 2003 15:24:32 +0200
Hi,

> I need to do both: translate and substring selection inside this 
> XSLT code bracked:
> 
> <xsl:for-each select="/FINCCIS/User/UserProfile/Services/Service">
> <xsl:variable name="position" select="position()"/>
> <xsl:if test="@name='Mail'">
> 
> <p><a href="{@type}://{@address}{@port}
> {substring(/FINCCIS/User/UserProfile/LogInName/@name,1,7)}.nsf
> " target="content">
> <img src="Email_program.gif" border="0" alt="foo"/>
> </a>
> 
> <br/>
> <b><a href="{@type}://{@address}{@port}
> {/FINCCIS/User/UserProfile/LogInName/@name}.nsf">
> <xsl:value-of select="document('lang_en_English.xml')
> /Language/Services/Service[$position]"/>
> </a>
> </b>	
> </p>
> </xsl:if>
>  ......
> ........ .
> ......
> more xsl:if 
> </xsl:for-each>
> 
> Now I know that with this separate 
> <xsl:for-each select="/FINCCIS/User/UserProfile/LogInName">
> <xsl:value-of select=
> "translate('TESTAAJA','ABCDEFGHIJKLMNOPQRSTYVW','abcdefghijklm
> nopqrstyvw')"/>
> </xsl:for-each>
> 
> I can get testaaja, but still there is question how to combine 
> these two functions inside AVT?

Why can't you just use

{substring(translate(/FINCCIS/User/UserProfile/LogInName/@name,'ABCDEFGHIJKLMNOPQRSTYVW','abcdefghijklmnopqrstyvw'),1,7)}

It would, also be worth saving 

  /FINCCIS/User/UserProfile/LogInName/@name

into a variable, already lower-cased.

Cheers,

Jarno - Neurotic Fish: Prostitute

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread