Subject: Re: [xsl] What does this XPath expression mean ? From: Kamal <kbhatt@xxxxxxxxx> Date: Sat, 22 Mar 2008 23:43:21 +1100 |
<blah label="A">1</blah> <blah label="A">2</blah> <blah label="B">3</blah> <blah label="B">4</blah> <blah label="C">5</blah>
The for-each expression is to iterate over a selected nodeset, that being defined by the select attribute (yes, you knew that)
The selected nodeset is all of the child nodes of the 'testResults' element, X, filtered by a predicate, P.
The unfiltered nodeset, X, is specified by the partial expression, '/testResults/*'.
The predicate is 'not(@label = preceding::*/@label)'.
So the final result nodeset is all the nodes selected by X excluding the nodes not statisifed by the predicate, P.
My guess is that you are having trouble interpreting the meaning of the predicate. If this the case, you may find the answer you require as follows:
The predicate (or filter expression) is the logical complement of
@label = preceding::*/@label
which factors out the not() wrapper.
So that leaves you with understanding that the nodes (rather, elements) *not* to be included in the result are all the elements with an attribute named 'label' are to be equal to any preceding element with the same label.
Now that is more-or-less of the matter but there are some finer points of XPath semantics that others on this fine list will no doubt amplify.
Hope this helps, though my answer is not complete in exact detail.
Cheers,
Justin Johansson
Could someone be kind to help me breaking down the XPath to explain whatthe expression means ?
<xsl:for-each select="/testResults/*[not(@label = preceding::*/@label)]">
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] What does this XPath expr, Justin Johansson | Thread | Re: [xsl] What does this XPath expr, Kevin Grover |
Re: [xsl] Is there a better way to , Kamal | Date | Re: [xsl] XSLT processor for Mac OS, Kamal |
Month |