Re: [xsl] how to evaluate a dyna generated variable?

Subject: Re: [xsl] how to evaluate a dyna generated variable?
From: Andrey Solonchuk <solo@xxxxxxx>
Date: Mon, 8 Sep 2003 12:51:44 +0300
Hello Cao,

Monday, September 8, 2003, 11:35:07 AM, you wrote:

CH> Hello,
CH>   I have defined the I18n resources with variables like this:
CH> <xsl:variable name="lang.type.participant.1" select="'Absolute Relation'"/>
CH> <xsl:variable name="lang.type.participant.2" select="'Relative Relation'"/>
CH> <xsl:variable name="lang.type.participant.3" select="'Group Expression'"/>

CH> and in my stylesheet, I want to get the resource like this:
CH> <xsl:value-of
CH> select="exsl:evaluate(concat('$lang.type.participant.',Type))">
CH> but it seems exsl:evaluate only accept variables that contain XPath
CH> reference,right? then is there any way to do this?

CH> Thanks
CH> Max Cao


I can't answer your question but for your situation you can
try following way, using document() function.

<?xml version="1.0" encoding="Windows-1251"?>
                exclude-result-prefixes="java my"
<xsl:output method="html" indent="yes"/>

   <lang.type.participant id="1">Absolute Relation</lang.type.participant>
   <lang.type.participant id="2">Relative Relation</lang.type.participant>
   <lang.type.participant id="3">Group Expression</lang.type.participant>

<xsl:template match="root">
        <xsl:value-of select="document('')//my:root/*[@id=1]/text()"/>
        <xsl:value-of select="document('')//my:root/*[@id=2]/text()"/>
        <xsl:value-of select="document('')//my:root/*[@id=3]/text()"/>


CH> _________________________________________________________
CH> Do You Yahoo!? 
CH> 启用电邮帐号,领会雅虎通[身临其境聊电影]的动感魅力,还有网络摄像头+雅虎通收音机等你来拿

CH>  XSL-List info and archive: 

Best regards,
 Andrey                            mailto:solo@xxxxxxx

 XSL-List info and archive:

Current Thread