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

Re: alternative to repeatedly walking the ancestor axi

Subject: Re: alternative to repeatedly walking the ancestor axis in 1.0
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 04 Aug 2008 10:27:31 -0400
Re:  alternative to repeatedly walking the ancestor axi
Hi,

At 06:00 AM 8/4/2008, you wrote:
2008/8/2 Michael Kay <mike@xxxxxxxxxxxx>:
>> Out of interest, does xml:lang annotate the input tree, or does the
>> lang() function walk the ancestor axis behind the scenes? Or
>> is it all implementation dependent?
>
> It's implementation-dependent, of course.
>
> Saxon walks the ancestor axis when you use the lang() function. I think it's
> used too rarely to be worth optimizing.


So (for Saxon anyway) doing:

test="lang('foo', .)"

is pretty much the same as:

test="ancestor-or-self::*/@xml:lang = 'foo'"

Or slightly more exactly, ancestor-or-self::*[@xml:lang]/@xml:lang = 'foo'


except that the lang() function should return true if the lang tested
is a subset of that declared in the attribute.

... and also the test is case-insensitive, in accordance with IETF RFC 3066 (http://www.ietf.org/rfc/rfc3066.txt), referenced by xml:lang (http://www.w3.org/TR/REC-xml/ section 2.12). So the xml:lang values of 'EN-GB', 'en-us' and 'en' all test true to lang()='en'.


So given an existing proprietary solution that walks the ancestor axis
a lot, you're not going to gain anything by switching to xml:lang...

I submit that speculating on performance differences vs alternatives is somewhat pointless, since it will depend on the implementation. It's not that it couldn't be optimized (especially if it were supported in the parser), so much as that it might not be.


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.