[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: Wed, 25 Apr 2012 12:33:07 +0100

So if I had done the semantically equivalent

<xsl:template match="*[key('maindoc','Sal',$doc2)]"

it would have been ok.

I would opine that the distinction warrants considering a clearer error message.

On Wed, Apr 25, 2012 at 9:22 AM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> In this example your call to key() is in a predicate. In a predicate you can
> use any XPath expression, with very few exceptions (for example, you can't
> call current-group()).
>
> In your previous example, the one that failed, the call to key() was outside
> a predicate. That's subject to the restrictions applicable to XSLT patterns,
> one of which is that the call must only have two arguments. (Another is that
> the key name must be a literal.)
>
>
> Michael Kay
> Saxonica


Current Thread
Keywords