[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: problem with XPath count()
> I want to count, for each element, the number of preceding <text> > elements that satisfy one or both of the following two conditions: 1) > the element is the first of the list or 2) its string value begins with > "x". Here is an example, with the expected number of the count after the > element: > > Firstly, I suspect you want the preceding-sibling axis rather than the preceding axis. The position() function returns the position of a node within the sequence of nodes being processed, not its position within an XML tree. If you use it within a predicate, it's the position of the item being tested within the sequence of things being tested, which in your case is the sequence of preceding text elements, in reverse document order. To test whether a node is the first element child of its parent, use not(preceding-siblling::*) Michael Kay Saxonica
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|