Login  Register

Using preceding-sibing in setvalue

classic Classic list List threaded Threaded
5 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Using preceding-sibing in setvalue

Stephanie Hall (TT)
94 posts

Hi all,

 

I’m running out of time on this project I am working on and so I am hoping someone can help me again:

 

I’m trying to set an instance’s value to be the position of the choice node where special = true in my main instance.

 

The xpath expression to find that particular node is

 

instance(‘my-instance’)/setup[os=’windows’]/choices/choice[special=’true’].  Only one node per OS will have special=’true’.

 

Can someone please tell me the correct syntax to get the position of that node?  I’ve tried many combinations but none seem to work.   

Doing “string(count(../preceding-sibling::choice[special=’true’])+1)” doesn’t seem to work as there are multiple OSes in this setup and I need the one that is for windows specifically (in this case).

 

Thanks!

Stephanie

 

 



--
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
| More
Print post
Permalink

Re: Using preceding-sibing in setvalue

HankRatz
25 posts
<base href="x-msg://68/">

Stephanie,

I may need more information... sample of the instance and binding.

Is special a node or an attribute? , i.e. .../choice[@special='true] 

Have you tried including/enabling the Inspector widget?  You can evaluate XPath 
statement from within your page.

Regards,
Hank

On Jan 5, 2010, at 12:27 PM, Stephanie Hall (TT) wrote:

Hi all,
 
I’m running out of time on this project I am working on and so I am hoping someone can help me again:
 
I’m trying to set an instance’s value to be the position of the choice node where special = true in my main instance.
 
The xpath expression to find that particular node is
 
instance(‘my-instance’)/setup[os=’windows’]/choices/choice[special=’true’].  Only one node per OS will have special=’true’.
 
Can someone please tell me the correct syntax to get the position of that node?  I’ve tried many combinations but none seem to work.   
Doing “string(count(../preceding-sibling::choice[special=’true’])+1)” doesn’t seem to work as there are multiple OSes in this setup and I need the one that is for windows specifically (in this case).
 
Thanks!
Stephanie
 
 

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

Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
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
| More
Print post
Permalink

Re: Using preceding-sibing in setvalue

Alessandro  Vernet
Administrator
5128 posts
In reply to this post by Stephanie Hall (TT)
Stephanie,

Assuming that the following XPath expression returns the "choice" node  
you are interested in:

instance(‘my-instance’)/setup[os=’windows’]/choices/choice
[special=’true’]

To get its position amongst other "choices" in the same "setup", you  
can write:

count(instance(‘my-instance’)/setup[os=’windows’]/choices/choice
[special=’true’]/preceding-sibling::choice) + 1

Alex



On Jan 5, 2010, at 12:27 PM, "Stephanie Hall (TT)" <[hidden email]
 > wrote:

> Hi all,
>
>
>
> I’m running out of time on this project I am working on and so I am  
> hoping someone can help me again:
>
>
>
> I’m trying to set an instance’s value to be the position of the choi
> ce node where special = true in my main instance.
>
>
>
> The xpath expression to find that particular node is
>
>
>
> instance(‘my-instance’)/setup[os=’windows’]/choices/choice
> [special=’true’].  Only one node per OS will have special=’true’.
>
>
>
> Can someone please tell me the correct syntax to get the position of  
> that node?  I’ve tried many combinations but none seem to work.
>
> Doing “string(count(../preceding-sibling::choice[special=’true’])
> +1)” doesn’t seem to work as there are multiple OSes in this setup a
> nd I need the one that is for windows specifically (in this case).
>
>
>
> Thanks!
>
> Stephanie
>
>
>
>
>
>
> --
> 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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

RE: Re: Using preceding-sibing in setvalue

Stephanie Hall (TT)
94 posts
Thanks a ton, Alex!  I think I wasn't putting the right thing after the
preceding-sibling::<this> part.  

-----Original Message-----
From: Alessandro Vernet [mailto:[hidden email]]
Sent: Tuesday, January 05, 2010 8:14 PM
To: [hidden email]
Subject: [ops-users] Re: Using preceding-sibing in setvalue

Stephanie,

Assuming that the following XPath expression returns the "choice" node
you are interested in:

instance('my-instance')/setup[os='windows']/choices/choice
[special='true']

To get its position amongst other "choices" in the same "setup", you can
write:

count(instance('my-instance')/setup[os='windows']/choices/choice
[special='true']/preceding-sibling::choice) + 1

Alex



On Jan 5, 2010, at 12:27 PM, "Stephanie Hall (TT)"
<[hidden email]
 > wrote:

> Hi all,
>
>
>
> I'm running out of time on this project I am working on and so I am
> hoping someone can help me again:
>
>
>
> I'm trying to set an instance's value to be the position of the choi
> ce node where special = true in my main instance.
>
>
>
> The xpath expression to find that particular node is
>
>
>
> instance('my-instance')/setup[os='windows']/choices/choice
> [special='true'].  Only one node per OS will have special='true'.
>
>
>
> Can someone please tell me the correct syntax to get the position of
> that node?  I've tried many combinations but none seem to work.
>
> Doing "string(count(../preceding-sibling::choice[special='true'])
> +1)" doesn't seem to work as there are multiple OSes in this setup a
> nd I need the one that is for windows specifically (in this case).
>
>
>
> Thanks!
>
> Stephanie
>
>
>
>
>
>
> --
> 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
| More
Print post
Permalink

Re: RE: Re: Using preceding-sibing in setvalue

Alessandro  Vernet
Administrator
5128 posts
Stephanie,

I'm glad it worked, and thanks for the update.

Alex



On Jan 6, 2010, at 6:34 AM, "Stephanie Hall (TT)" <[hidden email]
 > wrote:

> Thanks a ton, Alex!  I think I wasn't putting the right thing after  
> the
> preceding-sibling::<this> part.
>
> -----Original Message-----
> From: Alessandro Vernet [mailto:[hidden email]]
> Sent: Tuesday, January 05, 2010 8:14 PM
> To: [hidden email]
> Subject: [ops-users] Re: Using preceding-sibing in setvalue
>
> Stephanie,
>
> Assuming that the following XPath expression returns the "choice" node
> you are interested in:
>
> instance('my-instance')/setup[os='windows']/choices/choice
> [special='true']
>
> To get its position amongst other "choices" in the same "setup", you  
> can
> write:
>
> count(instance('my-instance')/setup[os='windows']/choices/choice
> [special='true']/preceding-sibling::choice) + 1
>
> Alex
>
>
>
> On Jan 5, 2010, at 12:27 PM, "Stephanie Hall (TT)"
> <[hidden email]
>> wrote:
>
>> Hi all,
>>
>>
>>
>> I'm running out of time on this project I am working on and so I am
>> hoping someone can help me again:
>>
>>
>>
>> I'm trying to set an instance's value to be the position of the choi
>> ce node where special = true in my main instance.
>>
>>
>>
>> The xpath expression to find that particular node is
>>
>>
>>
>> instance('my-instance')/setup[os='windows']/choices/choice
>> [special='true'].  Only one node per OS will have special='true'.
>>
>>
>>
>> Can someone please tell me the correct syntax to get the position of
>> that node?  I've tried many combinations but none seem to work.
>>
>> Doing "string(count(../preceding-sibling::choice[special='true'])
>> +1)" doesn't seem to work as there are multiple OSes in this setup a
>> nd I need the one that is for windows specifically (in this case).
>>
>>
>>
>> Thanks!
>>
>> Stephanie
>>
>>
>>
>>
>>
>>
>> --
>> 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


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet