Subject: Re: [xsl] Which XPath evaluates faster: count(../A) eq 1 or not( following-sibling::A) From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 4 Nov 2014 14:56:37 -0000 |
It depends entirely on the XPath processor you are using. For Saxon, I wouldn't expect to see a measurable difference. Unless there happen to be 100,000 B elements before the A on which you are positioned, in which case count(../A) might take rather longer. Michael Kay Saxonica mike@xxxxxxxxxxxx +44 (0) 118 946 5893 On 4 Nov 2014, at 13:57, Costello, Roger L. costello@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > Hi Folks, > > I am positioned in the XML tree at the first <A> element, within a <parent> element. > > Requirement: There must be only one <A> element within <parent>. > > Here are two XPath expressions to check that there is only one <A> element: > > count(../A) eq 1 > > or > > not(following-sibling::A) > > Which XPath expression evaluates faster? > > /Roger
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Which XPath evaluates faster:, Costello, Roger L. c | Thread | Re: [xsl] Which XPath evaluates fas, Wolfgang Laun wolfga |
Re: [xsl] Count of template matches, Wolfgang Laun wolfga | Date | Re: [xsl] Count of template matches, Dimitre Novatchev dn |
Month |