Re: [xsl] an error I do not understand

Subject: Re: [xsl] an error I do not understand
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Fri, 30 Sep 2011 09:47:42 +0100
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] 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.

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.)

Michael Kay

Current Thread