[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: type error on 3rd argument of key function

Subject: Re: type error on 3rd argument of key function
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 14 Feb 2013 18:18:01 +0100
Re:  type error on 3rd argument of key function
Ihe Onwuka wrote:
  <xsl:variable name="formats" as="element()+">
         <lookup:format from="eps" to="image"/>
         <lookup:format from="gif" to="image"/>
         <lookup:format from="jpg" to="image"/>
</xsl:variable>

Assuming the above is correctly typed and I have the following key declaration

<xsl:key name="formats" match="lookup:*/@to" use="../@from"/>

Then the following invocation fais

key('formats',xfile/@format,$
formats)

with the error

A sequence of more than one item is not allowed as the third argument
of key().......

But if I untype the $format variable (remove the as attribute from the
$format variable), it works.

Experienced this on Saxon 9.1.0,7 and 9.3.0.5.

You could use as="document-node()" if you want to use an "as" attribute to type annotate the variable.

I don't think keys work with sequences, you need a root node.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.