xxforms:variable does not work

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

xxforms:variable does not work

inanda.menezes
It seems that xxforms:variable does not work.
I've tested the example from the documentation and so far, I could not  print the values.

Version: orbeon-PE-3.9rc

XHTML:

<xhtml:head>
    <xforms:model id="my-model">
        <xforms:instance id="my-instance"><form>My-Instance Value</form></xforms:instance>
        <xxforms:variable name="mine" value="'TestValue'"/>
    </xforms:model>
    <xforms:model id="her-model">
        <xforms:instance id="her-instance"><form>Her-Instance Value</form></xforms:instance>
        <xxforms:variable name="hers" value="instance('her-instance')"/>
    </xforms:model>
</xhtml:head>
<xhtml:body>
   
    <xforms:output value="$mine">
        <xforms:label>My stuff:</xforms:label>
    </xforms:output>
    <xforms:group model="her-model">
       
        <xforms:output value="$hers">
            <xforms:label>Her stuff:</xforms:label>
        </xforms:output>
    </xforms:group>
</xhtml:body>
Reply | Threaded
Open this post in threaded view
|

Re: xxforms:variable does not work

inanda.menezes
I have checked it and I could print the value using the select attribute:


   <xforms:instance id="resource"><resource>value-1</resource></xforms:instance>       

<xxforms:variable name="variable1" select="instance(resource')"/>
<xforms:output id="control-1" value="$variable1"/>
 

But I should be able to use this variable inside the XPath, and it is not working. I am testing using the following code:

<xforms:instance id="next-resources"><values><value-1><next>value-5</value-1></next></values></xforms:instance>

<xforms:output id="control-2" value="instance('next-resources')/$variable1/next"/>

Reply | Threaded
Open this post in threaded view
|

Re: Re: xxforms:variable does not work

Hank Ratzesberger-2

Hi,

It's unclear to me how you are using the code.

I expect to see something like:

<xxforms:variable name="test" value="instance('my-inst')/pathto/value"/>

   <xforms:output value="$test"/>

Regards,
Hank


Quoting "inanda.menezes" <[hidden email]>:

> I have checked it and I could print the value using the select attribute:
>
>
>    value-1
>
>
>
>
>
> But I should be able to use this variable inside the XPath, and it is not
> working. I am testing using the following code:
>
> value-5
>
>
>
>
>
> --
> View this message in context:  
> http://orbeon-forms-ops-users.24843.n4.nabble.com/xxforms-variable-does-not-work-tp3444333p3444706.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>


--
Hank Ratzesberger
[hidden email]



--
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: xxforms:variable does not work

inanda.menezes
Hi, but I have a different situation.

I have the following instances:

<xforms:instance id="resource"><resource>value-1</resource></xforms:instance>       
<xforms:instance id="next-resources"><values><value-1><next>value-5</value-1></next></values></xforms:instance>

I want to get a value from the first instance and use this value inside my xpath expression:

<xxforms:variable name="variable1" select="instance(resource')"/> //Get the value 'value-1', it is working.

<xforms:output id="control-2" value="instance('next-resources')/$variable1/next"/>  //It should print 'value-5'. But it does not work.

I also tried to print using the ref attribute:
<xforms:output id="control-2" reference="instance('next-resources')/$variable1/next"/> // It also does not work.

I found a post about it, but it did not work. I don't know if it's something with this version 3.9 or if it is my mistake.
http://orbeon-forms-ops-users.24843.n4.nabble.com/xxforms-variable-inside-xPath-declaration-td2399957.html
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: xxforms:variable does not work

Hank Ratzesberger-2

Hi,

I'm writing from a "klunky" web email program.  Perhaps
I missed the source to your example.

I have use xxforms:variable in xforms:repeat and
other contexts for nodeset an atomic values, so

To "paraphrase,"

  <xforms:output value="instance('value-5"/pathto[thing=$value-1"/>

Of course, output requires an atomic/text value.

Consider posting your code to pastie.org or gist.github.org

Thank you,
Hank

Quoting "inanda.menezes" <[hidden email]>:

> Hi, but I have a different situation.
>
> I have the following instances:
>
> value-1
> value-5
>
> I want to get a value from the first instance and use this value inside my
> xpath expression:
>
>  //Get the value 'value-1', it is working.
>
>   //It should print 'value-5'. But it does not work.
>
> I also tried to print using the ref attribute:
>  // It also does not work.
>
> I found a post about it, but it did not work. I don't know if it's something
> with this version 3.9 or if it is my mistake.
> http://orbeon-forms-ops-users.24843.n4.nabble.com/xxforms-variable-inside-xPath-declaration-td2399957.html
>
>
> --
> View this message in context:  
> http://orbeon-forms-ops-users.24843.n4.nabble.com/xxforms-variable-does-not-work-tp3444333p3445448.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>


--
Hank Ratzesberger
[hidden email]



--
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: xxforms:variable does not work

Erik Bruchez
Administrator
In reply to this post by inanda.menezes
This:

instance('next-resources')/$variable1

doesn't make much sense.

I am going to make a while guess and assume that what you want is:

instance('next-resources')/[name() = $variable1]/next

-Erik

On Tue, Apr 12, 2011 at 7:03 AM, inanda.menezes <[hidden email]> wrote:

> I have checked it and I could print the value using the select attribute:
>
>
>   value-1
>
>
>
>
>
> But I should be able to use this variable inside the XPath, and it is not
> working. I am testing using the following code:
>
> value-5
>
>
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/xxforms-variable-does-not-work-tp3444333p3444706.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
>
>


--
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: xxforms:variable does not work

inanda.menezes
Thanks a lot Erik!

It was exactly what I wanted :D

The following expression worked:
instance('next-resources')/*[name() = $variable1]/next