[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: RE: Binding a variable within a "value-of select"
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 25 Oct 2005 19:40:36 +0100
missing binding for variable
> 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.