xsl-list
[Top] [All Lists]

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

2012-09-19 08:42:11
probably not(/Document/A[B]/B[2])

2012/9/19 Costello, Roger L. <costello(_at_)mitre(_dot_)org>:
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--