xsl-list
[Top] [All Lists]

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

2012-09-19 08:34:33
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>
--~--