xsl-list
[Top] [All Lists]

[xsl] XPath Expressions: Separate predicates or one predicate with AND?

2017-02-21 16:08:00
I’m updating code that has expressions like:

<xsl:when test=”*[@a = ‘1’ and @b = ‘2’ and @c = ‘3’]”>

My normal practice would be to use separate predicates:

<xsl:when test=”*[@a = ‘1’][@b = ‘2’][@c = ‘3’]”>

But it occurs to me that in this case the expressions are functionally 
identical: the set of predicates is effectively an AND group.

Is there any reason to prefer one form expression over the other?

I can imagine that different XSLT processors might apply different optimization 
strategies to the two forms, although as we’ve discussed many times, that’s not 
something you can worry about for general usage.

Cheers,

Eliot



--
Eliot Kimber
http://contrext.com
 

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>