[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] key() now has 3 arguments ... right


Subject: Re: [xsl] key() now has 3 arguments ... right
From: ihe onwuka <ihe.onwuka@xxxxxxxxxxxxxx>
Date: Thu, 26 Apr 2012 05:38:02 +0100

The reason I am having difficulty understanding the distinction being
expressed is that the code posted written with my (incorrect)
interpretation works as I intended and I haven't perceived a use case
where it doesn't work.

The examples given relating to maindoc and doc2 were contrived to
illustrate something that is not working.

What would help me understand is a use case that utilises the working
code to illustrate the distinctions, for me it does not translate into
words very well because although I get that there is some difference,
given the working example I cannot perceive that it matters.

On Wed, Apr 25, 2012 at 2:37 PM, David Carlisle <davidc@xxxxxxxxx> wrote:
> On 25/04/2012 14:14, ihe onwuka wrote:
>>
>> Right. it will match the current element if the key returns a node.
>>
>> If I do the keyed lookup on the current element name and nothing
>> else, there is no difference with the version you wrote.
>>
>> Correct?
>
>
> No, If I understand what you mean, that is not correct.
> atch="*[key('maindoc',name(),$doc2)]"
>
> will match any element if its name returns any node in the key if used
> as a lookup value. This is not at all the same as saying that the node
> being matched is returned by the key. Even if the key is defined in
> terms of name, say
>
> <xsl:key name="maindoc" match="*" use="name()"/>
>
> then the match expression is true for any node in any document if there
> is a node in $doc2 of that name. whereas
>
> match="key('maindoc',name(),$doc2)"
>
> if it were allowed, would presumably only match nodes that were returned
> by the key. In particular only nodes that are descendants of $doc2.
>
> ie one of the expressions I posted previously, or the simplified version
> Michael Kay just posted.
>
> David
>
>
>
>
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> ________________________________________________________________________


Current Thread