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

Hi.

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"?>
<xsl:stylesheet
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:java="http://xml.apache.org/xslt/java";
                xmlns:my="http://myurl";
                exclude-result-prefixes="java my"
                version="1.0">
<xsl:output method="html" indent="yes"/>

<my:root>
   <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>
</my:root>

<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()"/>
</xsl:template>

</xsl:stylesheet>



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

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



-- 
Best regards,
 Andrey                            mailto:solo@xxxxxxx


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


Current Thread