After hacking with the code to try to fix your bug I'm now not even sure its a bug. The following from the XPath spec...
Every axis has a principal node type. If an axis can contain elements, then the principal node type is element; otherwise, it is the type of the nodes that the axis can contain. Thus, * For the attribute axis, the principal node type is attribute. * For the namespace axis, the principal node type is namespace. * For other axes, the principal node type is element. Then * matches the principal node type. So any axis that can contain elements the * will only match elements. So preceding-sibling::* should only match elements by my interpretation of the spec. So I think Jaxen is behaving properly. You could change your XPath expression to be... preceding-sibling::processing-instruction() or preceding-sibling::node() I think thats the correct interpretation of the spec. Do others concur? James ----- Original Message ----- From: "Mattias Reichel" <[EMAIL PROTECTED]> To: "'bob mcwhirter'" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, April 18, 2002 4:26 PM Subject: RE: [Jaxen] Possible bug with processing instructions > I use dom4j 1.3 > > > -----Original Message----- > > From: [EMAIL PROTECTED] > [mailto:jaxen-interest- > > [EMAIL PROTECTED]] On Behalf Of bob mcwhirter > > Sent: den 18 april 2002 16:18 > > To: Mattias Reichel > > Cc: [EMAIL PROTECTED] > > Subject: RE: [Jaxen] Possible bug with processing instructions > > > > > > Hmmm... Sounds like a bug. > > > > So, standard questions: > > > > Which version of dom4j are you using? > > > > James? Any thoughts? > > > > -bob > > > > > > On Thu, 18 Apr 2002, Mattias Reichel wrote: > > > > > Nope! > > > > > > > -----Original Message----- > > > > From: bob mcwhirter [mailto:[EMAIL PROTECTED]] > > > > Sent: den 18 april 2002 16:09 > > > > To: Mattias Reichel > > > > Cc: [EMAIL PROTECTED] > > > > Subject: RE: [Jaxen] Possible bug with processing instructions > > > > > > > > > > > > Actually, now that I re-read the spec, I'm not certain what my > point > > > was. > > > > (One of those days). > > > > > > > > Okay, an axis has a primary node type, but, so what? > > > > > > > > > > > > Hmm... > > > > > > > > Does > > > > preceding-sibling::node() > > > > > > > > manage to find the PI? > > > > > > > > -bob > > > > > > > > > > > > On Thu, 18 Apr 2002, Mattias Reichel wrote: > > > > > > > > > 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? > > > > > > > > > > /Mattias > > > > > > > > > > > -----Original Message----- > > > > > > From: [EMAIL PROTECTED] > > > > > [mailto:jaxen-interest- > > > > > > [EMAIL PROTECTED]] On Behalf Of bob mcwhirter > > > > > > Sent: den 18 april 2002 15:47 > > > > > > To: Mattias Reichel > > > > > > Cc: [EMAIL PROTECTED] > > > > > > Subject: Re: [Jaxen] Possible bug with processing instructions > > > > > > > > > > > > > > > > > > XPath spec, 2.3: > > > > > > > > > > > > Every axis has a principal node type. If an axis can contain > > > elements, > > > > > > then the principal node type is element; otherwise, it is the > type > > > of > > > > > > the nodes that the axis can contain. Thus, > > > > > > > > > > > > * For the attribute axis, the principal node type is > > > attribute. > > > > > > * For the namespace axis, the principal node type is > > > namespace. > > > > > > * For other axes, the principal node type is element. > > > > > > > > > > > > --- > > > > > > > > > > > > So, preceding-sibling::* will select the preceding sibling of > the > > > > > > type 'element', as I read it. > > > > > > > > > > > > Am I misinterpreting the spec? > > > > > > > > > > > > -bob > > > > > > > > > > > > > > > > > > > > > > > > On Thu, 18 Apr 2002, Mattias Reichel wrote: > > > > > > > > > > > > > Hi, > > > > > > > I'm using dom4j and of course also jaxen for some xml > > > processing. > > > > > Got > > > > > > > into trouble when trying to get a hold of a processing > > > instruction > > > > > via > > > > > > > an xpath expression. > > > > > > > > > > > > > > Example: > > > > > > > <a> > > > > > > > <b/> > > > > > > > <?toc order-by="x"?> > > > > > > > <c/> > > > > > > > </a> > > > > > > > > > > > > > > c.selectSingleNode("preceding-sibling::*[1]"); > > > > > > > returns b. > > > > > > > > > > > > > > Best Regards > > > > > > > Mattias Reichel > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > 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