Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: position() in XPath query

From: "TarTar" <spam.spam@------.---->
To: NULL
Date: 10/2/2007 9:57:00 AM

Hi Dimitre,

Thanks a lot! Now the code works like a charm.

BTW
Could you explain (or point to a resource) what's the differenece between 
//name[position() > 10] and (//name)[position() > 10] ? The former one (with 
brackets) works perfectly - but why?

Leszek

"Dimitre Novatchev" <dimitren@t...> wrote in message 
news:46fdd7b9$0$47125$892e7fe2@a......
>
> "TarTar" <spam.spam@l...> wrote in message 
> news:u302wEeAIHA.4592@T......
>> Hello,
>>
>> Is there a way to use the position() function in the XPath query issued 
>> by the Select method of XPathNavigator?
>>
>> I have the code:
>> XPathDocument doc = new XPathDocument("data.xml");
>> XPathNavigator nav = doc.CreateNavigator();
>> XPathNodeIterator nodes = nav.Select("//name[positon() > 10]");
>>
>> I would like to obtain all names which positions are greater than 10. 
>> Currently this piece of code generates the error:
>> "Namespace Manager or XsltContext needed. This query has a prefix, 
>> variable, or user-defined function."
>>
>> How to solve this problem?
>
> I think there are at least two problems:
>
> 1.  There is no positon() function in XPath. Probably you meant position()
>
> 2.  Most probably the node-set selected by:
>
>    //name[position() > 10]
>
> is not what you want. Try the following XPath expression:
>
>    (//name)[position() > 10]
>
>
> Cheers,
> Dimitre Novatchev
> 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent