Re: [xsl] Multiple elements condition

Subject: Re: [xsl] Multiple elements condition
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 31 Aug 2007 14:37:25 -0400
Hi,

At 05:56 AM 8/31/2007, David replied to Andrew:
> I think there might be a rule here of "code the obvious"

yes actually I need the construct quite often in the day  job and what
we seem to have mostly is

foo[2] and not(foo[3])

which I think is reasonably clear and likely to be as efficient as
anything.

I agree this is preferable if only for reasons of clarity, and am glad to hear no one complain that it is unacceptably inefficient. :->


In XSLT 2.0 I'm starting to use exists(foo[2]) just since in my experience so many beginners just stumble over the nodeset-as-boolean test for existence. (And so many maintenance programmers are beginners! Tell me why that is.) So I might just excuse myself for "exists(foo[2]) and not(foo[3])", even though a beginner would probably guess what it does correctly and be wrong about why.

Of Abel's menagerie of equivalents -- all I can say is to agree with how remarkable the range of alternatives is. (As for the brain-teaser -- when would it ever select anything?)

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread