W3C home > Mailing lists > Public > www-forms@w3.org > January 2003

RE: How to do a dynamic XML lookup within a repeat?

From: Mark Birbeck <Mark.Birbeck@x-port.net>
Date: Mon, 20 Jan 2003 21:58:35 -0000
Message-ID: <E3ED00A7C285EE408679DE2A26D1C7818FFDA5@S007.x-port.net>
To: "'Dueck, Brian '" <bdueck@metasolv.com>, "''www-forms@w3.org' '" <www-forms@w3.org>

Hello Brian,

> The following lookup does not work as expected because the
> local-name(.) part of this XPath statement refers to the
> enclosing element xforms:instance('metaData'). What I need
> is a way to refer to the current node in the nodeset of the
> repeat element.
> [...]
>     <xforms:output
>
ref="xforms:instance('metaData')/element[@name=local-name(.)]/@label"> 
>         <xforms:label>MetaData Lookup=</xforms:label> 
>     </xforms:output> 

The answer to your question doesn't lie within XForms or FormsPlayer! You
need to use "current()" in place of ".", since as you rightly say, the
context for the @name comparison has changed to be the 'element'.

This works:

xforms:instance('metaData')/element[@name=local-name(current())]/@label

As it happens, this is a problem that people often have when doing XSLT, and
it also catches people out with xf:bind.

Best regards,

Mark Birbeck
x-port.net Ltd.
Received on Monday, 20 January 2003 17:01:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:54 GMT