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

Re: keys and collections

Subject: Re: keys and collections
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 21 Jun 2012 16:52:24 +0100
Re:  keys and collections
A key can only be used to search within a single document. You can, of course, construct the union of the results of searching each individual document using the key, like this:

$allInput/key('linebyfolio',$folio)

I'm not sure what you were trying to do with the /text/* so I've left that out of the equation.

Michael Kay
Saxonica



On 21/06/2012 16:37, Birnbaum, David J wrote:
Dear XSLT List,

Is it possible to use a key with a collection, along the lines of:

<xsl:variable name="allInput" select="collection('file:///path/?select=*.xml')/text/*"/>
<xsl:key name="linebyfolio" match="line" use="@folio"/>

And then, later:

key('linebyfolio',$folio,$allInput)

Using<oXygen/> 13.2 (configured to use Saxon-PE 9.3.0.5), this generates an error to the effect that: "A sequence of more than one item is not allowed as the third argument of key() (<title/>,<line/>, ...)." The children of the<text> elements in the collection are, indeed,<title> and<line> elements. Removing the "/text/*" from the path doesn't help; the error is then: "A sequence of more than one item is not allowed as the third argument of key() (document-node(), document-node(), ...)." I think I understand why this might be an error, but I seem to have a blind spot in figuring out how to work around it.

Thanks,

David
djbpitt@xxxxxxxxx

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.