Re: [xsl] an error I do not understand

Subject: Re: [xsl] an error I do not understand
From: Graydon <graydon@xxxxxxxxx>
Date: Fri, 30 Sep 2011 19:11:05 -0400
On Fri, Sep 30, 2011 at 09:47:42AM +0100, Michael Kay scripsit:
> On 30/09/2011 01:07, Graydon wrote:
> >So I've got a recurrent issue with taking big (~.5 Mlines, ~15 MiB)
> >files of metadata and merging them, or updating them.
> >
> >(this happens in an XSLT 2.0 environment.)
> >
> >Below is the minimal case of the error I do not understand:
> >
> >     <xsl:for-each select="$areaNames">
> >       <!-- F [Saxon-PE 9.3.0.5] Leading '/' cannot select the root node of the tree containing the context item: the context item is an atomic value -->
> >       <xsl:sequence select="key('name2Area',current())"/>
> 
> There's an implicit third argument to key(), telling it which
> document to search. The default value is effectively "/" - that is,
> the document containing the context node. If there isn't a context,
> node, using "/" fails.

My confusion is greatly reduced; thank you!

> I must see if I can improve the error message (the problem is that
> Saxon expands the call at an early stage to use "/" explicitly, so
> the error message reflects the query as Saxon rewrote it, not the
> original as you wrote it.)

There was indeed much searching for the slash. :)

Thanks!

-- Graydon

Current Thread