[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Which is faster: count(/Document/A/B) eq 1 ... or ... /Document/A/(count(B) eq 1) ?


Subject: Re: [xsl] Which is faster: count(/Document/A/B) eq 1 ... or ... /Document/A/(count(B) eq 1) ?
From: Вячеслав Седов <schematronic@xxxxxxxxx>
Date: Wed, 19 Sep 2012 17:41:57 +0400

probably not(/Document/A[B]/B[2])

2012/9/19 Costello, Roger L. <costello@xxxxxxxxx>:
> Hi Folks,
>
> Consider this XML document:
>
> <Document>
>     <A>
>         <B>blah</B>
>     </A>
> </Document>
>
> Here are two XPath expressions to test that there is exactly one <B> element in the <A> element (assume there is only one <A> element):
>
> 1. count(/Document/A/B) eq 1
>
> 2. /Document/A/(count(B) eq 1)
>
> Which is faster?
>
> Is there an XPath expression, besides the ones listed, that is even better and faster?
>
> /Roger


Current Thread
Keywords