xsl-list
[Top] [All Lists]

RE: Binding a variable within a "value-of select"

2005-10-25 11:40:36

I have a variable called "addorDef". All I need now is to use 
the value
of this variable within a path for another xsl:value-of.

<xsl:value-of select="WBSLServiceData/$addorDef/PostCode"/>

If $addorDef is a node-set then in XPath 2.0 this is a valid expression. If
WBSLServiceData is empty then the result is empty, otherwise the result is
the same as $addorDef/PostCode

But I suspect that $addorDef is actually a string. For example, perhaps it
is the string ABC. Your expression would then mean the same as

WBSLServiceData/"ABC"/PostCode

which is a type error: the lh operand of "/" must be a node-set, not a
string.

What you want is

WBSLServiceData/*[name() = $addorDef]/PostCode

Michael Kay
http://www.saxonica.com/



So a variabel within a variable.

I was thinking to use the { } as a solution.

<xsl:value-of select="WBSLServiceData/{$addorDef}/PostCode"/>
or
<xsl:value-of select="{WBSLServiceData/$addorDef/PostCode}"/>

But none of them works...

What am I missing?

Many Thanks,
Houman

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>