[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Multiple elements condition

Subject: Re: Re: Multiple elements condition
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 30 Aug 2007 11:59:11 -0400
Re: Re:  Multiple elements condition
At 06:14 PM 8/29/2007, you wrote:
> But I might opt for note[count(para)=2] as it's both concise, and
> quite obvious.

It is, but someone is certainly going to build or have an XSLT 2.0
processor that counts all 1000000 para elements and then confirms that
1000000 is not equal to 2

Yes, I know.


This presents me with one of those problems that's both philosophical and practical. Do I code against the possibility of poor or naive XSLT engines, even when the legibility and hence maintainability of my code suffers as a consequence?

The answer: frequently, yes.

But often, there are other mitigating factors. For example, I may know that there will never be more than a few para elements. Or I may know that only a particular processor, which knows how to optimize such expressions, is being used. Or I may be writing a one-off, which I'll run just once or a few times, and if there are performance problems I can deal with them lazily.

(FWIW, I almost never have performance problems with my XSLT. I think that has more to do with the scenarios for which I write -- the scale of the documents and data sets -- than it does with the way I write.)

So here's my style question of the month. In XSLT 2.0, should I prefer:

exists(para[2]) and not(exists(para[3]))

or

exists(para[2]) and empty(para[3])

? Is there ever any difference in functionality? I think the first is marginally more legible, but maybe the second gets out of the gate a microsecond faster.

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.