|
Subject: Re: [xsl] alternative to repeatedly walking the ancestor axis in 1.0 From: "Vladimir Nesterovsky" <vladimir@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 4 Aug 2008 03:38:42 -0700 |
> >> 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'"
>
> 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.
P.S.
You seems to be obsessed with an optimization of ancestor walks.
Are you
sure you have a problem in the first place?
--
Vladimir Nesterovsky
http://www.nesterovsky-bros.com/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] multiple values for the k, Mukul Gandhi | Thread | Re: [xsl] alternative to repeatedly, Andrew Welch |
| Re: [xsl] alternative to repeatedly, Andrew Welch | Date | Re: [xsl] alternative to repeatedly, Andrew Welch |
| Month |