I was thinking to use the { } as a solution.
{} is never Xpath syntax, so
<xsl:value-of select="WBSLServiceData/{$addorDef}/PostCode"/>
<xsl:value-of select="{WBSLServiceData/$addorDef/PostCode}"/>
are both syntax errors
<xsl:value-of select="WBSLServiceData/$addorDef/PostCode"/>
is legal syntax and if $addorDef contained a node set this would
evaluate to some value, but you say that it
contains a ___string___ so the above is equivalent to
<xsl:value-of select="WBSLServiceData/'def'/PostCode"/>
which is a type error you can't use a string in the middle of an Xpath.
variables hold values, not fragments of Xpath syntax. If you have a
variable foo in C (or Java or pretty much any other language you choose)
that contained a string such as " + 1" you wouldn't expect to be able to
use
2 foo
to expand to
2 + 1
and so evaluate to 3.
variables in XSL are (a bit) like variables in C they are not like C
preprocessor macros.
If you have a variable that contains Xpath syntax then you need an
extension function that makes an Xpath parser available at run time.
(eg saxon:evaluate) or if the variable is just a single element name the
FFFFAQ answer is
WBSLServiceData/*[name()=$addorDef]/PostCode
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--~------------------------------------------------------------------
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>
--~--