Hi again, After testing the patch I've found that it is still a bit erroneous.
<a> <b>foo</b> <?toc order-by="x"?> <c>bar</c> </a> Node n1 = c.selectSingleNode("preceding-sibling::*"); Node n2 = c.selectSingleNode("preceding-sibling::node()"); Node n3 = c.selectSingleNode("preceding-sibling::processing-instruction()"); n1.getName() returns 'b' n1.getText() returns 'foo' n2.getName() returns null n2.getText() returns an empty string n3.getName() returns 'toc' n3.getText() returns 'order-by="x"' I would expect that n2 would return the same values as n3. /Mattias > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:jaxen-interest- > [EMAIL PROTECTED]] On Behalf Of James Strachan > Sent: den 19 april 2002 13:43 > To: Mattias Reichel > Cc: [EMAIL PROTECTED] > Subject: Re: [Jaxen] Possible bug with processing instructions > > OK all my patches are now in CVS and the test cases are all working > correctly now. > > James > ----- Original Message ----- > From: "James Strachan" <[EMAIL PROTECTED]> > To: "Mattias Reichel" <[EMAIL PROTECTED]>; "'bob mcwhirter'" > <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Friday, April 19, 2002 1:14 PM > Subject: Re: [Jaxen] Possible bug with processing instructions > > > > I've fixed that locally so it should work fine. Will be checking it in > > shortly - will let you know when. I just wanted to check I'd interpreted > the > > spec right first. > > > > Here's the test cases that work locally for me now - I think these look > > right... Lemme know if I've missed anything > > > > Its using your example XML doc with some text in the elements to make > the > > tests a bit easier... > > > > <a> > > <b>foo</b> > > <?toc order-by="x"?> > > <c>bar</c> > > </a> > > > > > > <document url="xml/pi2.xml"> > > <context select="/a/c"> > > <test select="//processing-instruction()" count="1"/> > > <test select="preceding-sibling::*" count="1"/> > > <test select="preceding-sibling::node()" count="5"/> > > <test select="preceding-sibling::*[1]" count="1"/> > > <test select="preceding-sibling::processing-instruction()" > count="1"/> > > <valueOf > > > select="preceding-sibling::processing-instruction()">order- > by="x"</valueOf> > > <valueOf select="preceding-sibling::*[1]">foo</valueOf> > > <valueOf > select="preceding-sibling::node()[2]">order-by="x"</valueOf> > > </context> > > </document> > > > > > > James > > ----- Original Message ----- > > From: "Mattias Reichel" <[EMAIL PROTECTED]> > > To: "'James Strachan'" <[EMAIL PROTECTED]>; "'bob mcwhirter'" > > <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Friday, April 19, 2002 1:16 PM > > Subject: RE: [Jaxen] Possible bug with processing instructions > > > > > > > Ok, but it doesn't work with node() or processing-instruction() either > > > > > > <a> > > > <b/> > > > <?toc order-by="x"?> > > > <c/> > > > </a> > > > > > > c.selectSingleNode("preceding-sibling::*") returns b > > > c.selectSingleNode("preceding-sibling::node()") returns b > > > c.selectSingleNode("preceding-sibling::processing-instruction()") > > > returns null > > > > > > /Mattias > > > > > > > -----Original Message----- > > > > From: [EMAIL PROTECTED] > > > [mailto:jaxen-interest- > > > > [EMAIL PROTECTED]] On Behalf Of James Strachan > > > > Sent: den 19 april 2002 12:44 > > > > To: Mattias Reichel; 'bob mcwhirter' > > > > Cc: [EMAIL PROTECTED] > > > > Subject: Re: [Jaxen] Possible bug with processing instructions > > > > > > > > From: "Mattias Reichel" <[EMAIL PROTECTED]> > > > > > Hmm, > > > > > > > > > > Switching to preceding axis for clarity, but issue is the same. > > > > > > > > > > From Michael Kay's XSLT Programmers Reference 2nd Edition by Wrox > > > Press, > > > > > page 364: > > > > > > > > > > preceding: > > > > > This selects all the nodes that appear before the origin node, > > > excluding > > > > > the ancestors of the origin, in reverse document order. If the > > > origin is > > > > > an element node, this effectively means that it contains all the > > > text > > > > > nodes, element nodes, comments, and processing instructions in the > > > > > document that finish before the start tag of the origin element. > The > > > > > preceding axis will never contain attribute or namespace nodes. > > > > > > > > > > Is he dead wrong here or what? > > > > > > > > The XPath spec also says... > > > > > > > > the preceding-sibling axis contains all the preceding siblings of > the > > > > context node; if the context node is an attribute node or namespace > > > node, > > > > the preceding-sibling axis is empty > > > > > > > > > > > > The issue is how does the '*' node test filter the axis. > > > > > > > > So the preceding-sibling axis contains all previous nodes of any > type. > > > > Though using "*" filters the axis to just elements. Using node() > will > > > see > > > > all node types. Using processsing-instruction() will only see PIs > etc. > > > > > > > > I think this is correct. Am about to build some more test cases to > > > check > > > > this is how Jaxen behaves... > > > > > > > > James > > > > > > > > > > > > _________________________________________________________ > > > > Do You Yahoo!? > > > > Get your free @yahoo.com address at http://mail.yahoo.com > > > > > > > > > > > > _______________________________________________ > > > > Jaxen-interest mailing list > > > > [EMAIL PROTECTED] > > > > https://lists.sourceforge.net/lists/listinfo/jaxen-interest > > > > > > > > > > > > _______________________________________________ > > > Jaxen-interest mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/jaxen-interest > > > > > > _________________________________________________________ > > Do You Yahoo!? > > Get your free @yahoo.com address at http://mail.yahoo.com > > > > > > _______________________________________________ > > Jaxen-interest mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jaxen-interest > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > _______________________________________________ > Jaxen-interest mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jaxen-interest _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest