[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Error: XPTY0020: Leading '/' cannot select the roo
On 10/01/2011 11:35, Dietrich Bollmann wrote:
<xsl:template match="/"> <body> <xsl:for-each select="tokenize(example/bar/@ids, ',')"> <xsl:value-of select="."/>:<xsl:value-of select="key('index', .)" /> </xsl:for-each> </body> </xsl:template> The xsl:for-each select="tokenize()" changes the context item, so key() no longer knows which tree to search in. Change it to <xsl:variable name="root" select="/"/> <xsl:template match="/"> <body> <xsl:for-each select="tokenize(example/bar/@ids, ',')"> <xsl:value-of select="."/>:<xsl:value-of select="key('index', ., $root)" /> </xsl:for-each> </body> </xsl:template> Michael Kay Saxonica
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|