Subject: Re: [xsl] Error: XPTY0020: Leading '/' cannot select the root node of the tree containing the context item: the context item is an atomic value From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Mon, 10 Jan 2011 12:42:46 +0100 |
<xsl:key name="index" match="//*[@id]" use="./@id" />
<xsl:template match="/"> <body> <xsl:for-each select="tokenize(example/bar/@ids, ',')"> <xsl:value-of select="."/>:<xsl:value-of select="key('index', .)" />
I get the following error:
--- $ saxon -s:example.xml -xsl:example-b.xsl
Error on line 12 of example-b.xsl: XPTY0020: Leading '/' cannot select the root node of the tree containing the context item: the context item is an atomic value Failed to compile stylesheet. 1 error detected.
Use <xsl:variable name="d1" select="/"/> outside of the for-each, then use key('index', ., $d1) inside of the for-each.
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Error: XPTY0020: Leading , Michael Kay | Thread | Re: [xsl] Error: XPTY0020: Leading , Andrew Welch |
Re: [xsl] Error: XPTY0020: Leading , Michael Kay | Date | Re: [xsl] Error: XPTY0020: Leading , Andrew Welch |
Month |