xsl-list
[Top] [All Lists]

Re: [xsl] alternative to repeatedly walking the ancestor axis in 1.0

2008-08-04 09:07:41
P.S. You seems to be obsessed with an optimization of ancestor walks.
Are you sure you have a problem in the first place?

Obsessed is the wrong word - perhaps "mildly interested" is more
accurate - but yes I would say it's a problem to have to walk the
ancestor axis for every node.  Why?   It can be expensive depending on
the tree model and it prevents potential streaming optimisations.

And of course, when the application is large enough and used by enough
people, a slight performance tweak can save a lot of money.


Then simply use keys as shown in my first reply to this thread.


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play



On Mon, Aug 4, 2008 at 4:45 AM, Andrew Welch 
<andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> wrote:
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'"

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

No. See: http://www.w3.org/TR/xpath-functions/#func-lang

fn:lang($testlang as xs:string?, $node as node()) as xs:boolean

"This function tests whether the language of $node, or the context item if 
the second argument is omitted, as specified by xml:lang attributes is the 
same as, or is a sublanguage of, the language specified by $testlang."

Please notice "sublanguage" word.

That's what I read, I noticed it!  I think I may have got it the wrong
way around, but the principle is still the same: you get a bit more
functionality using lang() than you do with just checking for the
attribute.

If you disagree, please say a little more than "no" with a quote.


P.S. You seems to be obsessed with an optimization of ancestor walks.
Are you sure you have a problem in the first place?

Obsessed is the wrong word - perhaps "mildly interested" is more
accurate - but yes I would say it's a problem to have to walk the
ancestor axis for every node.  Why?   It can be expensive depending on
the tree model and it prevents potential streaming optimisations.

And of course, when the application is large enough and used by enough
people, a slight performance tweak can save a lot of money.

--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--

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