Subject: RE: [xsl] XPath preceding From: "Rick Quatro" <rick@xxxxxxxxxxxxxx> Date: Mon, 9 Apr 2012 14:35:49 -0400 |
Hi Michael, As Wendell pointed out, this should work according to the XPath spec. However, I am using it with FrameSLT (an XPath plugin for Adobe FrameMaker) and apparently there is a bug where the preceding axis doesn't work if the elements have different parents. It actually works like preceding-sibling. I have to send Russ a bug report. Wendell, a belated thanks for your quick reply. Rick -----Original Message----- From: Michael M|ller-Hillebrand [mailto:mmh@xxxxxxxxxxxxx] Sent: Monday, April 09, 2012 2:28 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] XPath preceding Hi Rick, http://www.w3.org/TR/xpath/#axes > the preceding axis contains all nodes in the same document as the > context node that are before the context node in document order, > excluding any ancestors and excluding attribute nodes and namespace > nodes If you have access to XPath 2 you could use he new << and >> operators, but I guess you have not. So if I read on in the spec: > NOTE: The ancestor, descendant, following, preceding and self axes partition a document (ignoring attribute and namespace nodes): they do not overlap and together they contain all the nodes in the document. I would assume you have to built something like this: preceding::case-cite or ancestor::*//case-cite as ancestors (and their descendants) are also before the current node in document order but not part of the preceding:: axis. - Michael Am 09.04.2012 um 17:09 schrieb Rick Quatro: > Hello, > > I am trying to find a particular element that is anywhere before the > current element like this: > > preceding::case-cite > > This works if the two elements have the same parent, but I want to > match an element anywhere before the current element. For example, if > the context is the <case-cite-2nd> element, I want to find a > <case-cite> element anywhere in the structure previous to the <case-cite-2nd> element. > > <root> > <section> > <para> > <case-cite/> > </para> > <para> > <case-cite-2nd/> > </para> > </section> > </root> > > Thanks in advance. > > Rick Quatro
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XPath preceding, Michael Müller-Hille | Thread | [xsl] Response to Wolfgang Laun, Mi, Peterson, Melanie S. |
Re: [xsl] XPath preceding, Michael Müller-Hille | Date | [xsl] Response to Wolfgang Laun, Mi, Peterson, Melanie S. |
Month |