|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: NodeTest expected here - problem with creating xs
On Mon, 26 Aug 2002 15:53:59 -0700, Chuck White wrote:
>...
><xsl:variable name="lookup" select="document('LookupTable.xml')" />
><xsl:key name="keyedLookupTable" match="LookupTable/Value" use="@key"/>
You might as well just say match="Value", unless you really do have
Value elements which are *not* children of a LookupTable and you want
to ignore them.
>
><xsl:value-of select="$lookup[key('keyedLookupTable' , $currentKey)]"/>
>...
Not quite. This will either return an empty string or the string
value of the *whole* LookupTable.xml document, according to whether
there are any nodes in the document matching $currentKey.
You are executing the key() function in the right context, but
unfortunately there isn't a way of getting at the value: it is being
cast to a boolean which is then used to filter the node set $lookup,
which contains a single node which is the root node of the
LookupTable.xml document.
See Wendell's message for the right approach, using xsl:for-each. Or
use XPath 2.0, where there is a pure XPath syntax for changing
context.
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email
Melvaig Software Engineering Limited
voice: +44 (0) 1445 771 271
email: tcn@xxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








