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

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 UTC