Well, Even if it could be considered a bug, it is not likely that Mark Logic would fix that overnight. So for now you are best off just keeping the difference in mind. ;-)
About the actual meaning and so.. Right.. that takes some digging. I found the following section in the Xpath 2.0 recommendation (http://www.w3.org/TR/xpath20/#abbrev): " 3. Each non-initial occurrence of // is effectively replaced by /descendant-or-self::node()/ during processing of a path expression. For example, div1//para is short for child::div1/descendant-or-self::node()/child::para and so will select all para descendants of div1 children. Note: The path expression //para[1] does not mean the same as the path expression /descendant::para[1]. The latter selects the first descendant para element; the former selects all descendant para elements that are the first para children of their respective parents. " Especially the note is interesting. It confirms that the abbreviated syntax is at least evaluated correctly. The elaborate version though, using the position() function, is more difficult to prove. The Xpath 2.0 functions specification (http://www.w3.org/TR/xpath-functions/#func-position) talks about the dynamic context. But I always found that though matter. Who can tell for sure what is meant with the context list in expressions like these? (I prefer using braces to make sure mistakes are not possible.) Though I was surprised, I now think MarkLogic Server is responding correctly. Perhaps someone at Mark Logic might add to this conversation? They are after all contributing to the W3C rec.. :-) Kind regards, Geert > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > Pradeep Maddireddy > Sent: donderdag 26 maart 2009 22:44 > To: General Mark Logic Developer Discussion > Subject: RE: [MarkLogic Dev General] issue with XPATH > > Geert, > > So is that an issue or is it how it works. > > Thanks > Pradeep Maddireddy > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > Geert Josten > Sent: Thursday, March 26, 2009 5:14 PM > To: General Mark Logic Developer Discussion > Subject: RE: [MarkLogic Dev General] issue with XPATH > > Pradeep, > > Yes, I think the result should be the same. It looks like the > first approach is interpreted as (doc(..)//b)[position() = 2]. > > Eric, > > Yes, a = b returns true if any item from sequence a is equal > to any item in sequence b. You can best see it as an > intersect on atomic values, returning all items in a that are > also in b, but none in b that are not in a though.. > > Kind regards, > Geert > > > > > > Drs. G.P.H. Josten > Consultant > > > http://www.daidalos.nl/ > Daidalos BV > Source of Innovation > Hoekeindsehof 1-4 > 2665 JZ Bleiswijk > Tel.: +31 (0) 10 850 1200 > Fax: +31 (0) 10 850 1199 > http://www.daidalos.nl/ > KvK 27164984 > De informatie - verzonden in of met dit emailbericht - is > afkomstig van Daidalos BV en is uitsluitend bestemd voor de > geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, > verzoeken wij u het te verwijderen. Aan dit bericht kunnen > geen rechten worden ontleend. > > > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Eric > > Palmitesta > > Sent: donderdag 26 maart 2009 21:46 > > To: General Mark Logic Developer Discussion > > Subject: Re: [MarkLogic Dev General] issue with XPATH > > > > Perhaps I spoke too soon! > > > > As I understand, A=B means "return true if A is found > anywhere in the > > sequence B". Can someone confirm this? > > > > Thanks (and sorry to derail), > > > > Eric > > > > Eric Palmitesta wrote: > > > Equality testing of non-sequences should use "eq". Try... > > > > > > [position() eq 2] > > > > > > Eric > > > > > > Pradeep Maddireddy wrote: > > >> Hi..! > > >> > > >> > > >> > > >> I have a document with the following content > > >> > > >> > > >> > > >> <root> > > >> > > >> <a> > > >> > > >> <b id="1-1">1</b> > > >> > > >> </a> > > >> > > >> <a> > > >> > > >> <b id="2-1">1</b> > > >> > > >> <b id="2-2">1</b> > > >> > > >> </a> > > >> > > >> <a> > > >> > > >> <b id="3-1">1</b> > > >> > > >> <b id="3-2">1</b> > > >> > > >> </a> > > >> > > >> </root> > > >> > > >> > > >> > > >> I think both the following xpath expression should give the same > > >> result but they are giving different results, is it an issue in > > >> marklogic > > >> > > >> > > >> > > >> doc("/root/ab.xml")//b[position()=2] > > >> > > >> > > >> > > >> <b id="2-1">1</b> > > >> > > >> > > >> > > >> doc("/root/ab.xml")//b[2] > > >> > > >> > > >> > > >> <b id="2-2">1</b> > > >> <b id="3-2">1</b> > > >> > > >> > > >> > > >> > > >> > > >> Thanks > > >> > > >> Pradeep Maddireddy > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > > --------------------------------------------------------------------- > > >> --- > > >> > > >> _______________________________________________ > > >> General mailing list > > >> [email protected] > > >> http://xqzone.com/mailman/listinfo/general > > > _______________________________________________ > > > General mailing list > > > [email protected] > > > http://xqzone.com/mailman/listinfo/general > > _______________________________________________ > > General mailing list > > [email protected] > > http://xqzone.com/mailman/listinfo/general > > > > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > > > > > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
