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

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

From: Dueck, Brian <bdueck@metasolv.com>
Date: Mon, 20 Jan 2003 17:45:40 -0600
Message-ID: <E8F1B37FC20ED74BAC2685B05C799714555A7D@srvtoemail.metasolv.com>
To: "'Mark Birbeck '" <Mark.Birbeck@x-port.net>, "Dueck, Brian" <bdueck@metasolv.com>, "'''www-forms@w3.org' ' '" <www-forms@w3.org>
Thanks Mark - figured it was something easy! And yeah, now that I think of
it, I did have to use current() in some XSLT as well. I'll give it a try. 

Regards,

Brian.

-----Original Message-----
From: Mark Birbeck
To: 'Dueck, Brian '; ''www-forms@w3.org' '
Sent: 20/01/03 3:58 PM
Subject: RE: How to do a dynamic XML lookup within a repeat?

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 18:51:32 GMT

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