Element access based on dynamic path?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Element access based on dynamic path?

Jeroen Hoffman
Element access based on dynamic path?

Hi,
I'm looking for a way to access some document element based on the value of a variable, so the path should be created dynamicaly.

More specifically, I have a variable with a message code, trying to get the message from a resources.

Using the variable in the ref or the value attribute of an output doesn't work.
<xforms:output value="instance('current-resources')/$path-to-message"/>
<xforms:output instance="current-resources" ref="$path-to-message"/>
(or variations)

Any suggestions? Is there a function for this perhaps?

Tnx
Jeroen Hoffman



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Element access based on dynamic path?

Jeroen Hoffman
Element access based on dynamic path?
Found it! (within 10 mins..)
 
Using xxforms:evaluate

<xforms:output ref="xxforms:evaluate(concat('instance(''current-resources'')/', $path-to-message))"/>
 
Jeroen
 


From: Jeroen Hoffman [mailto:[hidden email]]
Sent: donderdag 12 februari 2009 16:17
To: [hidden email]
Subject: [ops-users] Element access based on dynamic path?

Hi,
I'm looking for a way to access some document element based on the value of a variable, so the path should be created dynamicaly.

More specifically, I have a variable with a message code, trying to get the message from a resources.

Using the variable in the ref or the value attribute of an output doesn't work.
<xforms:output value="instance('current-resources')/$path-to-message"/>
<xforms:output instance="current-resources" ref="$path-to-message"/>
(or variations)

Any suggestions? Is there a function for this perhaps?

Tnx
Jeroen Hoffman



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Element access based on dynamic path?

fl.schmitt(ops-users)
In reply to this post by Jeroen Hoffman
Jeroen,

> I'm looking for a way to access some document element based on the value
> of a variable, so the path should be created dynamicaly.
>
> More specifically, I have a variable with a message code, trying to get
> the message from a resources.
>
> Using the variable in the ref or the value attribute of an output
> doesn't work.
> <xforms:output value="instance('current-resources')/$path-to-message"/>
> <xforms:output instance="current-resources" ref="$path-to-message"/>
> (or variations)
>
> Any suggestions? Is there a function for this perhaps?
maybe the xxforms:evaluate function could be used:

http://www.orbeon.com/ops/doc/reference-xforms-functions#orbeon-extensions

<xforms:output instance="current-resources"
ref="xxforms:evaluate($path-to-message)"/>

another way could be not to store the xpath in the variable, but the
node itself, as in the following example:

http://www.orbeon.com/ops/doc/reference-xforms-2#variables
(variable current-item)

Then you could use the variable direcly in the ref attribute.

HTH
florian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: Element access based on dynamic path?

Jeroen Hoffman

Thanks for your time, as you probably have seen the xxforms:evaluate
works out very well!

Jeroen

-----Original Message-----
From: Florian Schmitt [mailto:[hidden email]]
Sent: donderdag 12 februari 2009 16:39
To: [hidden email]
Subject: [ops-users] Re: Element access based on dynamic path?

Jeroen,

> I'm looking for a way to access some document element based on the
value
> of a variable, so the path should be created dynamicaly.
>
> More specifically, I have a variable with a message code, trying to
get
> the message from a resources.
>
> Using the variable in the ref or the value attribute of an output
> doesn't work.
> <xforms:output
value="instance('current-resources')/$path-to-message"/>
> <xforms:output instance="current-resources" ref="$path-to-message"/>
> (or variations)
>
> Any suggestions? Is there a function for this perhaps?

maybe the xxforms:evaluate function could be used:

http://www.orbeon.com/ops/doc/reference-xforms-functions#orbeon-extensio
ns

<xforms:output instance="current-resources"
ref="xxforms:evaluate($path-to-message)"/>

another way could be not to store the xpath in the variable, but the
node itself, as in the following example:

http://www.orbeon.com/ops/doc/reference-xforms-2#variables
(variable current-item)

Then you could use the variable direcly in the ref attribute.

HTH
florian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws